Re-enable prettier format checking. Disable with flag (#43548)

This commit is contained in:
Petri-Johan Last 2022-10-31 12:14:42 +02:00 committed by GitHub
parent cb52e51164
commit cc0a842a69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 74 additions and 30 deletions

View File

@ -10,5 +10,14 @@ describe('Timestamp', () => {
test('noAbout', () => expect(render(<Timestamp date="2006-01-02" noAbout={true} />).asFragment()).toMatchSnapshot())
test('absolute time with formatting', () => expect(render(<Timestamp date="2006-01-02T01:02:00Z" timestampFormat={TimestampFormat.FULL_TIME} preferAbsolute={true} />).asFragment()).toMatchSnapshot())
test('absolute time with formatting', () =>
expect(
render(
<Timestamp
date="2006-01-02T01:02:00Z"
timestampFormat={TimestampFormat.FULL_TIME}
preferAbsolute={true}
/>
).asFragment()
).toMatchSnapshot())
})

View File

@ -414,9 +414,7 @@ export const ActionItemsToggle: React.FunctionComponent<React.PropsWithChildren<
<Icon
aria-hidden={true}
svgPath={
window.context.enableLegacyExtensions
? mdiPuzzleOutline
: mdiChevronDoubleDown
window.context.enableLegacyExtensions ? mdiPuzzleOutline : mdiChevronDoubleDown
}
/>
)}

View File

@ -96,11 +96,7 @@ export class ToggleHistoryPanel extends React.PureComponent<
}
return (
<Tooltip content={`${visible ? 'Hide' : 'Show'} history (Alt+H/Opt+H)`}>
<RepoHeaderActionButtonLink
aria-label={visible ? 'Hide' : 'Show'}
file={false}
onSelect={this.onClick}
>
<RepoHeaderActionButtonLink aria-label={visible ? 'Hide' : 'Show'} file={false} onSelect={this.onClick}>
<Icon aria-hidden={true} svgPath={mdiHistory} />
</RepoHeaderActionButtonLink>
</Tooltip>

View File

@ -30,13 +30,10 @@ export const LoggedOutHomepage: React.FunctionComponent<React.PropsWithChildren<
{...props}
/>
</div>
<div className="d-flex align-items-center justify-content-lg-center my-5">
<H4 className={classNames('mr-2 mb-0 pr-2', styles.proTipTitle)}>Pro Tip</H4>
<Link
to="https://signup.sourcegraph.com/"
onClick={() => eventLogger.log('ClickedOnCloudCTA')}
>
<Link to="https://signup.sourcegraph.com/" onClick={() => eventLogger.log('ClickedOnCloudCTA')}>
Use Sourcegraph to search across your team's code.
</Link>
</div>

View File

@ -198,7 +198,7 @@ export const visitorsTasks: TourTaskType[] = [
},
// This is done to mimic user creating an account, and signed in there is a different tour
completeAfterEvents: ['non-existing-event'],
}
},
],
},
]

View File

@ -112,7 +112,7 @@ export const Tooltip: FC<TooltipProps> = props => {
}
}
const isOpen = useDebounce(open, 100)
const isOpen = useDebounce(open, 100)
return (
<>
@ -120,7 +120,7 @@ export const Tooltip: FC<TooltipProps> = props => {
{children}
</TooltipTarget>
{content && target && isOpen &&(
{content && target && isOpen && (
<>
<PopoverContent
role="tooltip"

View File

@ -4,6 +4,6 @@ This package is a collection of CLI tools to perform various operations in batch
- `bulkrepocreate`: generates blank repositories in large numbers on a codehost within an organization.
- `bulkreposettings`: updates the settings of all repositories of an organization all at once.
- `codehostcopy`: copies repositories from one codehost to another.
- `codehostcopy`: copies repositories from one codehost to another.
Please see the individual READMEs for how to use these tools.

View File

@ -1,8 +1,8 @@
# Bulkreposettings
A CLI tool to update an organization repositories settings in batch.
A CLI tool to update an organization repositories settings in batch.
Supported operations:
Supported operations:
- set visibility to _private_.
@ -10,13 +10,13 @@ Supported codehosts:
- GitHub and GitHub enterprise.
## Usage
## Usage
`go run ./dev/scaletesting/bulkreposettings [flags...]`
Flags:
Flags:
- Authenticating:
- Authenticating:
- `github.token`: GHE Token to create the repositories (required).
- `github.url`: Base URL to the GHE instance (ex: `https://ghe.sgdev.org`) (required).
- `github.org`: Existing organization to create the repositories in (required).

View File

@ -430,7 +430,7 @@ func (r *Runner[Args]) runAllCategoryChecks(ctx context.Context, args Args) *run
}
// Write the terminal summary to an indented block
var style = output.CombineStyles(output.StyleBold, output.StyleFailure)
style := output.CombineStyles(output.StyleBold, output.StyleFailure)
block := r.Output.Block(output.Linef(output.EmojiFailure, style, check.Name))
block.Writef("%s\n", check.cachedCheckErr)
if check.cachedCheckOutput != "" {

View File

@ -52,7 +52,6 @@ var Targets = []Target{
Description: "Documentation checks",
Checks: []*linter{
runScript("Docsite lint", "dev/docsite.sh check"),
prettier,
},
},
{
@ -71,7 +70,6 @@ var Targets = []Target{
inlineTemplates,
runScript("Yarn duplicate", "dev/check/yarn-deduplicate.sh"),
checkUnversionedDocsLinks(),
prettier,
},
},
{
@ -93,6 +91,14 @@ var Targets = []Target{
},
}
var FormattingTarget = Target{
Name: "format",
Description: "Check client code and docs for formatting errors",
Checks: []*linter{
prettier,
},
}
// runScript creates check that runs the given script from the root of sourcegraph/sourcegraph.
func runScript(name string, script string) *linter {
return &linter{

View File

@ -12,8 +12,7 @@ import (
)
var prettier = &linter{
Name: "Prettier",
Enabled: disabled("Temporarily disabled to figure out unknown failure"),
Name: "Prettier",
// TODO unfortunate that we have to use 'dev/ci/yarn-run.sh'
Check: func(ctx context.Context, out *std.Output, args *repo.State) error {
return root.Run(run.Cmd(ctx, "dev/ci/yarn-run.sh format:check")).

View File

@ -31,6 +31,13 @@ var lintFailFast = &cli.BoolFlag{
Value: true,
}
var lintNoFormatCheck = &cli.BoolFlag{
Name: "no-format-check",
Aliases: []string{"nfc"},
Usage: "Don't check file formatting",
Value: false,
}
var lintCommand = &cli.Command{
Name: "lint",
ArgsUsage: "[targets...]",
@ -57,6 +64,7 @@ sg lint --help
generateAnnotations,
lintFix,
lintFailFast,
lintNoFormatCheck,
},
Before: func(cmd *cli.Context) error {
// If more than 1 target is requested, hijack subcommands by setting it to nil
@ -97,6 +105,11 @@ sg lint --help
return errors.Wrap(err, "repo.GetState")
}
if !lintNoFormatCheck.Get(cmd) {
lintTargets = append(lintTargets, linters.FormattingTarget)
targets = append(targets, linters.FormattingTarget.Name)
}
runner := linters.NewRunner(std.Out, generateAnnotations.Get(cmd), lintTargets...)
if cmd.Bool("fix") {
std.Out.WriteNoticef("Fixing checks from targets: %s", strings.Join(targets, ", "))
@ -106,7 +119,7 @@ sg lint --help
std.Out.WriteNoticef("Running checks from targets: %s", strings.Join(targets, ", "))
return runner.Check(cmd.Context, repoState)
},
Subcommands: lintTargets(linters.Targets).Commands(),
Subcommands: lintTargets(append(linters.Targets, linters.FormattingTarget)).Commands(),
}
type lintTargets []linters.Target

View File

@ -386,6 +386,7 @@ Flags:
* `--fail-fast, --ff`: Exit immediately if an issue is encountered (not available with '-fix')
* `--feedback`: provide feedback about this command by opening up a GitHub discussion
* `--fix, -f`: Try to fix any lint issues
* `--no-format-check, --nfc`: Don't check file formatting
### sg lint urls
@ -446,6 +447,15 @@ Flags:
Check shell code for linting errors, formatting, etc.
Flags:
* `--feedback`: provide feedback about this command by opening up a GitHub discussion
### sg lint format
Check client code and docs for formatting errors.
Flags:
* `--feedback`: provide feedback about this command by opening up a GitHub discussion

View File

@ -109,7 +109,23 @@ func addSgLints(targets []string) func(pipeline *bk.Pipeline) {
cmd = cmd + "-v "
}
cmd = cmd + "lint -annotations -fail-fast=false " + strings.Join(targets, " ")
var (
branch = os.Getenv("BUILDKITE_BRANCH")
tag = os.Getenv("BUILDKITE_TAG")
// evaluates what type of pipeline run this is
runType = runtype.Compute(tag, branch, map[string]string{
"BEXT_NIGHTLY": os.Getenv("BEXT_NIGHTLY"),
"RELEASE_NIGHTLY": os.Getenv("RELEASE_NIGHTLY"),
"VSCE_NIGHTLY": os.Getenv("VSCE_NIGHTLY"),
})
)
formatCheck := ""
if runType.Is(runtype.MainBranch) || runType.Is(runtype.MainDryRun) {
formatCheck = "--no-format-check "
}
cmd = cmd + "lint -annotations -fail-fast=false " + formatCheck + strings.Join(targets, " ")
return func(pipeline *bk.Pipeline) {
pipeline.AddStep(":pineapple::lint-roller: Run sg lint",