-
Notifications
You must be signed in to change notification settings - Fork 53
FIX: @W-16371174@: Fix bug with config commands case insensitivity #1705
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| # label.command-state | ||
|
|
||
| Developer Preview | ||
| Beta | ||
|
|
||
| # warning.command-state | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,7 +6,7 @@ | |
| "bugs": "https://github.com/forcedotcom/sfdx-scanner/issues", | ||
| "dependencies": { | ||
| "@oclif/core": "^3.3.2", | ||
| "@salesforce/code-analyzer-core": "0.20.1", | ||
| "@salesforce/code-analyzer-core": "0.20.2", | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the main fix |
||
| "@salesforce/code-analyzer-engine-api": "0.16.1", | ||
| "@salesforce/code-analyzer-eslint-engine": "0.17.0", | ||
| "@salesforce/code-analyzer-flowtest-engine": "0.16.2", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,7 +23,6 @@ export interface ConfigModel { | |
| } | ||
|
|
||
| export class AnnotatedConfigModel implements ConfigModel { | ||
| private readonly config: CodeAnalyzerConfig; // TODO: It would be nice if we updated the CodeAnalyzer (in our core module) to just return its CodeAnalyzerConfig with a getter so we didn't need to pass it around | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With the other enhancements that I just pulled in, I was able to accomplish this TODO item as well. |
||
| private readonly codeAnalyzer: CodeAnalyzer; | ||
| private readonly userRules: RuleSelection; | ||
| private readonly allDefaultRules: RuleSelection; | ||
|
|
@@ -34,8 +33,7 @@ export class AnnotatedConfigModel implements ConfigModel { | |
| // configs not associated with the user's rule selection, thus we can't use the engines from allDefaultRules. | ||
| private readonly relevantEngines: Set<string>; | ||
|
|
||
| constructor(config: CodeAnalyzerConfig, codeAnalyzer: CodeAnalyzer, userRules: RuleSelection, allDefaultRules: RuleSelection, relevantEngines: Set<string>) { | ||
| this.config = config; | ||
| constructor(codeAnalyzer: CodeAnalyzer, userRules: RuleSelection, allDefaultRules: RuleSelection, relevantEngines: Set<string>) { | ||
| this.codeAnalyzer = codeAnalyzer; | ||
| this.userRules = userRules; | ||
| this.allDefaultRules = allDefaultRules; | ||
|
|
@@ -45,9 +43,9 @@ export class AnnotatedConfigModel implements ConfigModel { | |
| toFormattedOutput(format: OutputFormat): string { | ||
| // istanbul ignore else: Should be impossible | ||
| if (format === OutputFormat.STYLED_YAML) { | ||
| return new StyledYamlFormatter(this.config, this.codeAnalyzer, this.userRules, this.allDefaultRules, this.relevantEngines).toYaml(); | ||
| return new StyledYamlFormatter(this.codeAnalyzer, this.userRules, this.allDefaultRules, this.relevantEngines).toYaml(); | ||
| } else if (format === OutputFormat.RAW_YAML) { | ||
| return new PlainYamlFormatter(this.config, this.codeAnalyzer, this.userRules, this.allDefaultRules, this.relevantEngines).toYaml(); | ||
| return new PlainYamlFormatter(this.codeAnalyzer, this.userRules, this.allDefaultRules, this.relevantEngines).toYaml(); | ||
| } else { | ||
| throw new Error(`Unsupported`) | ||
| } | ||
|
|
@@ -61,8 +59,8 @@ abstract class YamlFormatter { | |
| private readonly allDefaultRules: RuleSelection; | ||
| private readonly relevantEngines: Set<string>; | ||
|
|
||
| protected constructor(config: CodeAnalyzerConfig, codeAnalyzer: CodeAnalyzer, userRules: RuleSelection, allDefaultRules: RuleSelection, relevantEngines: Set<string>) { | ||
| this.config = config; | ||
| protected constructor(codeAnalyzer: CodeAnalyzer, userRules: RuleSelection, allDefaultRules: RuleSelection, relevantEngines: Set<string>) { | ||
| this.config = codeAnalyzer.getConfig(); | ||
| this.codeAnalyzer = codeAnalyzer; | ||
| this.userRules = userRules; | ||
| this.allDefaultRules = allDefaultRules; | ||
|
|
@@ -214,8 +212,8 @@ abstract class YamlFormatter { | |
| } | ||
|
|
||
| class PlainYamlFormatter extends YamlFormatter { | ||
| constructor(config: CodeAnalyzerConfig, codeAnalyzer: CodeAnalyzer, userRules: RuleSelection, allDefaultRules: RuleSelection, relevantEngines: Set<string>) { | ||
| super(config, codeAnalyzer, userRules, allDefaultRules, relevantEngines); | ||
| constructor(codeAnalyzer: CodeAnalyzer, userRules: RuleSelection, allDefaultRules: RuleSelection, relevantEngines: Set<string>) { | ||
| super(codeAnalyzer, userRules, allDefaultRules, relevantEngines); | ||
| } | ||
|
|
||
| protected toYamlComment(commentText: string): string { | ||
|
|
@@ -224,8 +222,8 @@ class PlainYamlFormatter extends YamlFormatter { | |
| } | ||
|
|
||
| class StyledYamlFormatter extends YamlFormatter { | ||
| constructor(config: CodeAnalyzerConfig, codeAnalyzer: CodeAnalyzer, userRules: RuleSelection, allDefaultRules: RuleSelection, relevantEngines: Set<string>) { | ||
| super(config, codeAnalyzer, userRules, allDefaultRules, relevantEngines); | ||
| constructor(codeAnalyzer: CodeAnalyzer, userRules: RuleSelection, allDefaultRules: RuleSelection, relevantEngines: Set<string>) { | ||
| super(codeAnalyzer, userRules, allDefaultRules, relevantEngines); | ||
| } | ||
|
|
||
| protected toYamlComment(commentText: string): string { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -141,11 +141,11 @@ export class ResultsTableDisplayer extends AbstractResultsDisplayer { | |
| protected _view(results: RunResults) { | ||
| const violations: Violation[] = sortViolations(results.getViolations()); | ||
| const parentFolder: string = findLongestCommonParentFolderOf(violations.map(v => | ||
| getPrimaryLocation(v).getFile()).filter(f => f !== undefined)); | ||
| v.getPrimaryLocation().getFile()).filter(f => f !== undefined)); | ||
|
|
||
| const resultRows: ResultRow[] = violations.map((v, idx) => { | ||
| const severity = v.getRule().getSeverityLevel(); | ||
| const primaryLocation = getPrimaryLocation(v); | ||
| const primaryLocation: CodeLocation = v.getPrimaryLocation(); | ||
| const relativeFile: string | null = primaryLocation.getFile() ? | ||
| path.relative(parentFolder, primaryLocation.getFile()!) : null; | ||
| return { | ||
|
|
@@ -193,11 +193,6 @@ function sortViolations(violations: Violation[]): Violation[] { | |
| }); | ||
| } | ||
|
|
||
| // TODO: We should update core module to have this function directly on the Violation object and then remove this helper | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With the other enhancements that I just pulled in, I was able to accomplish this TODO item as well. |
||
| function getPrimaryLocation(violation: Violation): CodeLocation { | ||
| return violation.getCodeLocations()[violation.getPrimaryLocationIndex()]; | ||
| } | ||
|
|
||
| /** | ||
| * Returns the longest comment parent folder of the file paths provided | ||
| * Note that this function assumes that all the paths are indeed files and not folders | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[FIX-AS-YOU-GO item] We don't want to forget to update this to say "Beta" instead of "Developer Preview" now.