Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
rrousselGit authored Dec 5, 2023
2 parents 978fab8 + 5b5b0dd commit c56f6b6
Show file tree
Hide file tree
Showing 13 changed files with 59 additions and 14 deletions.
6 changes: 5 additions & 1 deletion packages/custom_lint/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
## Unreleased patch
## Unreleased fix

- `// ignore` comments now correctly respect indentation when they are inserted (thanks to @PiotrRogulski)

## 0.5.7 - 2023-11-20

- Support JSON output format via CLI parameter `--format json|default` (thanks to @kuhnroyal)

Expand Down
1 change: 0 additions & 1 deletion packages/custom_lint/example/example_lint/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: custom_lint_example_lint
version: 0.0.9
publish_to: none

environment:
Expand Down
1 change: 0 additions & 1 deletion packages/custom_lint/example/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: custom_lint_example_app
version: 0.0.1
publish_to: none

environment:
Expand Down
2 changes: 1 addition & 1 deletion packages/custom_lint/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: custom_lint
version: 0.5.6
version: 0.5.7
description: Lint rules are a powerful way to improve the maintainability of a project. Custom Lint allows package authors and developers to easily write custom lint rules.
repository: https://github.com/invertase/dart_custom_lint
issue_tracker: https://github.com/invertase/dart_custom_lint/issues
Expand Down
28 changes: 28 additions & 0 deletions packages/custom_lint/test/ignore_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,34 @@ void fn2() {}
expectMatchesGoldenFixes(fixes);
});

test('Emits indented ignore quick-fix', () async {
final plugin = createPlugin(
name: 'test_lint',
main: source,
);

final app = createLintUsage(
name: 'test_app',
plugins: {'test_lint': plugin.uri},
source: {
'lib/main.dart': '''
void fn() {}
''',
},
);

final runner = await startRunnerForApp(app);
await runner.getLints(reload: false);
final fixes = await runner
.getFixes(app.file('lib', 'main.dart').path, 10)
.then((e) => e.fixes);

expect(
fixes[0].fixes[0].change.edits[0].edits[0].replacement,
startsWith('${' ' * 4}// ignore: hello_world'),
);
});

test('supports `// ignore: code`', () async {
final plugin = createPlugin(
name: 'test_lint',
Expand Down
4 changes: 2 additions & 2 deletions packages/custom_lint/tools/analyzer_plugin/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: custom_lint_analyzer_plugin_loader
description: This pubspec determines the version of the analyzer plugin to load.
version: 0.5.6
version: 0.5.7
publish_to: none

environment:
sdk: ">=2.14.0 <4.0.0"

dependencies:
custom_lint: 0.5.6
custom_lint: 0.5.7

# TODO: If you want to contribute to custom_lint, add a pubspec_overrides.yaml file
# in this folder, containing the following:
Expand Down
9 changes: 9 additions & 0 deletions packages/custom_lint_builder/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## Unreleased fix

- `// ignore` comments now correctly respect indentation when they are inserted (thanks to @PiotrRogulski)

## 0.5.7 - 2023-11-20

- `custom_lint` upgraded to `0.5.7`
- `custom_lint_core` upgraded to `0.5.7`

## 0.5.6 - 2023-10-30

- `custom_lint` upgraded to `0.5.6`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: custom_lint_builder_example_lint
version: 0.0.9
publish_to: none

environment:
Expand Down
1 change: 0 additions & 1 deletion packages/custom_lint_builder/example/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: custom_lint_builder_example_app
version: 0.0.1
publish_to: none

environment:
Expand Down
6 changes: 5 additions & 1 deletion packages/custom_lint_builder/lib/src/ignore.dart
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,13 @@ class IgnoreCode extends DartFix {

final startLineOffset = resolver.lineInfo.getOffsetOfLine(offsetLine);

final indentLength = resolver.source.contents.data
.substring(startLineOffset)
.indexOf(RegExp(r'\S'));

builder.addSimpleInsertion(
startLineOffset,
'// ignore: ${analysisError.errorCode.name}\n',
'${' ' * indentLength}// ignore: ${analysisError.errorCode.name}\n',
);
}
});
Expand Down
6 changes: 3 additions & 3 deletions packages/custom_lint_builder/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: custom_lint_builder
version: 0.5.6
version: 0.5.7
description: A package to help writing custom linters
repository: https://github.com/invertase/dart_custom_lint

Expand All @@ -12,10 +12,10 @@ dependencies:
collection: ^1.16.0
# Using tight constraints as custom_lint_builder communicate with each-other
# using a specific contract
custom_lint: 0.5.6
custom_lint: 0.5.7
# Using tight constraints as custom_lint_builder communicate with each-other
# using a specific contract
custom_lint_core: 0.5.6
custom_lint_core: 0.5.7
glob: ^2.1.1
hotreloader: ">=3.0.5 <5.0.0"
meta: ^1.7.0
Expand Down
4 changes: 4 additions & 0 deletions packages/custom_lint_core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.5.7 - 2023-11-20

- `custom_lint` upgraded to `0.5.7`

## 0.5.6 - 2023-10-30

- `custom_lint` upgraded to `0.5.6`
Expand Down
4 changes: 2 additions & 2 deletions packages/custom_lint_core/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: custom_lint_core
version: 0.5.6
version: 0.5.7
description: A package to help writing custom linters
repository: https://github.com/invertase/dart_custom_lint

Expand All @@ -12,7 +12,7 @@ dependencies:
collection: ^1.16.0
# Using tight constraints as custom_lint_builder communicate with each-other
# using a specific contract
custom_lint: 0.5.6
custom_lint: 0.5.7
matcher: ^0.12.0
meta: ^1.7.0
path: ^1.8.0
Expand Down

0 comments on commit c56f6b6

Please sign in to comment.