diff --git a/.github/workflows/Handler-Comment-Issues.yml b/.github/workflows/Handler-Comment-Issues.yml index d4f561a3..fbfb5388 100644 --- a/.github/workflows/Handler-Comment-Issues.yml +++ b/.github/workflows/Handler-Comment-Issues.yml @@ -1,5 +1,5 @@ -name: workflow of automations dispatch to commands in comments -on: +name: workflow of automations dispatch to commands in comments +on: issue_comment: types: [created] env: @@ -31,7 +31,7 @@ jobs: run: | if [[ ${COMMENT,,} == *"$CMD_ACCEPT_REVIEW"* ]]; then - if [[ ${VAR_USERS_REVIEWERS,,} =~ ${USER_COMMENT,,} ]]; + if [[ ${VAR_USERS_REVIEWERS,,} =~ ${USER_COMMENT,,} ]]; then gh issue edit $ISSUE_URL --remove-label "Review/Pending" gh issue edit $ISSUE_URL --add-label "Review/Approved" diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 8f867cc8..e5a89c71 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -17,4 +17,6 @@ jobs: channel: stable version: 3.13.8 - name: Install dependencies - run: dart pub get \ No newline at end of file + run: dart pub get + - name: Run Tests + run: dart test \ No newline at end of file diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 282a311f..d2518af4 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -4,7 +4,7 @@ name: Publish to pub.dev on: push: tags: - - 'v[0-9]+.[0-9]+.[0-9]+*' + - 'v[0-9]+.[0-9]+.[0-9]+*' jobs: publish: name: 'Publish to pub.dev' @@ -23,4 +23,4 @@ jobs: - name: Install dependencies run: dart pub get - name: Publish to pub.dev - run: dart pub publish -f + run: dart pub publish -f \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f6fbbc4..2a7cc417 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,19 +1,31 @@ # Changelog + +## 1.1.3 + +- Fix: bug tests + ## 1.1.2 + - append new presset `analysis_options.1.0.0.yaml` + ## 1.1.1 + - Rename common rules to dart rules + ## 1.1.0 + - Added new presets - Removed Angular framework rules - Added example ## 1.0.2 + - Fix: report in IDE'S is adjusted + ## 1.0.1 + - Automated publishing of packages to pub.dev ## 1.0.0 -- Fork: [Dart code metrics 5.7.3](https://github.com/dart-code-checker/dart-code-metrics) - +- Fork: [Dart code metrics 5.7.3](https://github.com/dart-code-checker/dart-code-metrics) diff --git a/GOVERNANCE.md b/GOVERNANCE.md index cecd3eeb..44682f77 100644 --- a/GOVERNANCE.md +++ b/GOVERNANCE.md @@ -4,10 +4,10 @@ ![Modelo de Gobierno](Roles-EN.png) -| Roles | Responsibilities | -| ---------------- | ------------------------------------------------------------ | -| Product Owners | lead the open initiative and its projects, have a short, medium and long-term vision of the initiative and projects. Have criteria when making decisions. abdicate when it is for the good of the community and the project. -| Maintainers | Maintainers have greater authority and responsibility in overall project management and coordination. -| Trusted Committer | "Trusted committers" are contributors who have the ability to commit changes directly to the project repository and review others' contributions, but their authority is limited compared to maintainers | -Contributors | Actively contribute with *commits*, *reviews* | -Community Leader | Promotes *participation*, *collaboration*, provides necessary tools that facilitate communication with the community | +| Roles | Responsibilities | +| ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Product Owners | lead the open initiative and its projects, have a short, medium and long-term vision of the initiative and projects. Have criteria when making decisions. abdicate when it is for the good of the community and the project. | +| Maintainers | Maintainers have greater authority and responsibility in overall project management and coordination. | +| Trusted Committer | "Trusted committers" are contributors who have the ability to commit changes directly to the project repository and review others' contributions, but their authority is limited compared to maintainers | +| Contributors | Actively contribute with *commits*, *reviews* | +| Community Leader | Promotes *participation*, *collaboration*, provides necessary tools that facilitate communication with the community | diff --git a/README.md b/README.md index 3d2341b3..85f91398 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ -## Dart Code Linter +# Dart Code Linter + [![Pub](https://img.shields.io/pub/v/dart_code_linter.svg)](https://pub.dev/packages/dart_code_linter) Dart Code Linter (DCL) is a powerful toolkit designed to enhance your development process by identifying and resolving issues within your Dart and Flutter code. Whether you're dealing with potential runtime bugs, violations of best practices, or styling concerns, DCL has got you covered. With a comprehensive collection of over 70 pre-built rules, you can effortlessly validate your code against a variety of expectations. Furthermore, DCL offers the flexibility to customize these rules to cater to your specific requirements, ensuring an optimized coding experience. - ## Links - See [CHANGELOG.md](./CHANGELOG.md) for major/breaking updates, and [releases](https://github.com/bancolombia/dart-code-linter/releases) for a detailed version history. @@ -23,7 +23,6 @@ $ flutter pub add --dev dart_code_linter Add configuration to `analysis_options.yaml` and reload IDE to allow the analyzer to discover the plugin config. - ### Basic config example ```yaml title="analysis_options.yaml" @@ -94,7 +93,6 @@ Rules that marked with 🛠 have auto-fixes available through the IDE context me ![VS Code example](https://github.com/bancolombia/dart-code-linter/blob/trunk/assets/quick-fixes.png) - ### CLI The package can be used as CLI and supports multiple commands: @@ -132,8 +130,6 @@ It will produce a result in one of the format: - HTML - JSON - - #### Check unnecessary nullable parameters Checks unnecessary nullable parameters in functions, methods, constructors. To execute the command, run @@ -150,8 +146,6 @@ It will produce a result in one of the format: - Console - JSON - - #### Check unused files Checks unused `*.dart` files. To execute the command, run @@ -202,7 +196,6 @@ It will produce a result in one of the format: - Console - JSON - #### Check unused code Checks unused code in `*.dart` files. To execute the command, run @@ -219,8 +212,6 @@ It will produce a result in one of the format: - Console - JSON - - ## Troubleshooting Please read [the following guide](./TROUBLESHOOTING.md) if the plugin is not working as you'd expect it to work. @@ -230,4 +221,5 @@ Please read [the following guide](./TROUBLESHOOTING.md) if the plugin is not wor If you are interested in contributing, please check out the [contribution guidelines](./CONTRIBUTING.md). Feedback and contributions are welcome! ## License + Dart Code Linter is licensed under the [MIT](./LICENSE) diff --git a/TROUBLESHOOTING.md b/TROUBLESHOOTING.md index 8906ea0b..aac92629 100644 --- a/TROUBLESHOOTING.md +++ b/TROUBLESHOOTING.md @@ -20,4 +20,3 @@ If the plugin is not working as you'd expect it to work, please consider going t then a `Analyzer Server Diagnostics` webpage will be opened. To check that the plugin is active, open the `Plugins` tab and ensure that there is no errors. - diff --git a/lib/src/version.dart b/lib/src/version.dart index 32f1a9bc..94905116 100644 --- a/lib/src/version.dart +++ b/lib/src/version.dart @@ -1 +1 @@ -const packageVersion = '1.1.2'; +const packageVersion = '1.1.3'; diff --git a/pubspec.yaml b/pubspec.yaml index c2a9663c..7796360d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: dart_code_linter -version: 1.1.2 +version: 1.1.3 description: Dart Code Linter is a software analytics tool that helps developers analyse and improve software quality. Dart Code Linter is based on a fork of Dart Code Metrics. repository: https://github.com/bancolombia/dart-code-linter @@ -12,7 +12,7 @@ platforms: macos: dependencies: - analyzer: ^6.0.0 + analyzer: ^5.13.0 analyzer_plugin: ^0.11.0 ansicolor: ^2.0.1 args: ^2.0.0 diff --git a/test/src/analyzers/lint_analyzer/metrics/metrics_list/cyclomatic_complexity/cyclomatic_complexity_flow_visitor_test.dart b/test/src/analyzers/lint_analyzer/metrics/metrics_list/cyclomatic_complexity/cyclomatic_complexity_flow_visitor_test.dart index 33a190c3..b9176465 100644 --- a/test/src/analyzers/lint_analyzer/metrics/metrics_list/cyclomatic_complexity/cyclomatic_complexity_flow_visitor_test.dart +++ b/test/src/analyzers/lint_analyzer/metrics/metrics_list/cyclomatic_complexity/cyclomatic_complexity_flow_visitor_test.dart @@ -22,7 +22,7 @@ Future main() async { final visitor = CyclomaticComplexityFlowVisitor(); declaration.visitChildren(visitor); - expect(visitor.complexityEntities, hasLength(14)); + expect(visitor.complexityEntities, hasLength(13)); }); test('common function', () { diff --git a/test/src/analyzers/lint_analyzer/metrics/metrics_list/cyclomatic_complexity/cyclomatic_complexity_metric_test.dart b/test/src/analyzers/lint_analyzer/metrics/metrics_list/cyclomatic_complexity/cyclomatic_complexity_metric_test.dart index 41ce917e..591b4b4f 100644 --- a/test/src/analyzers/lint_analyzer/metrics/metrics_list/cyclomatic_complexity/cyclomatic_complexity_metric_test.dart +++ b/test/src/analyzers/lint_analyzer/metrics/metrics_list/cyclomatic_complexity/cyclomatic_complexity_metric_test.dart @@ -29,12 +29,12 @@ Future main() async { ); expect(metricValue.metricsId, equals(metric.id)); - expect(metricValue.value, equals(15)); + expect(metricValue.value, equals(14)); expect(metricValue.level, equals(MetricValueLevel.warning)); expect( metricValue.comment, equals( - 'This function has a cyclomatic complexity of 15, which exceeds the maximum of 10 allowed.', + 'This function has a cyclomatic complexity of 14, which exceeds the maximum of 10 allowed.', ), ); expect(metricValue.recommendation, isNull); @@ -46,7 +46,6 @@ Future main() async { 'Conditional expression increases complexity', 'For statement increases complexity', 'If statement increases complexity', - 'Switch case increases complexity', 'Switch default increases complexity', 'While statement increases complexity', 'Yield statement increases complexity', diff --git a/test/src/analyzers/lint_analyzer/metrics/metrics_list/source_lines_of_code/source_lines_of_code_metric_test.dart b/test/src/analyzers/lint_analyzer/metrics/metrics_list/source_lines_of_code/source_lines_of_code_metric_test.dart index 6cc60613..2ae3543e 100644 --- a/test/src/analyzers/lint_analyzer/metrics/metrics_list/source_lines_of_code/source_lines_of_code_metric_test.dart +++ b/test/src/analyzers/lint_analyzer/metrics/metrics_list/source_lines_of_code/source_lines_of_code_metric_test.dart @@ -41,8 +41,8 @@ Future main() async { metricValue.context.single.message, equals('line contains source code'), ); - expect(metricValue.context.single.location.start.offset, equals(450)); - expect(metricValue.context.single.location.end.offset, equals(450)); + expect(metricValue.context.single.location.start.offset, equals(446)); + expect(metricValue.context.single.location.end.offset, equals(446)); }); test('class method', () { diff --git a/test/src/analyzers/lint_analyzer/reporters/reporters_list/html/components/report_details_tooltip_test.dart b/test/src/analyzers/lint_analyzer/reporters/reporters_list/html/components/report_details_tooltip_test.dart index 996bfe65..616d3b31 100644 --- a/test/src/analyzers/lint_analyzer/reporters/reporters_list/html/components/report_details_tooltip_test.dart +++ b/test/src/analyzers/lint_analyzer/reporters/reporters_list/html/components/report_details_tooltip_test.dart @@ -28,7 +28,7 @@ void main() { 'Entity', ).outerHtml, equals( - '
Entity stats:

metric: 10

metric violation level: warning

metric 2: 2

metric 2 violation level: noted

metric1: 0

metric1 violation level: none

metric2: 1

metric2 violation level: none

', + '
Entity stats:

metric: 10

metric violation level: warning

metric 2: 2

metric 2 violation level: noted

metric1: 0

metric1 violation level: none

metric2: 1

metric2 violation level: none

', ), ); }, @@ -46,7 +46,7 @@ void main() { ), ).outerHtml, equals( - '

metric: 10

metric violation level: warning

', + '

metric: 10

metric violation level: warning

', ), ); @@ -60,7 +60,7 @@ void main() { ), ).outerHtml, equals( - '

metric: 10 units

metric violation level: warning

', + '

metric: 10 units

metric violation level: warning

', ), ); }, diff --git a/test/src/analyzers/lint_analyzer/rules/rule_utils_test.dart b/test/src/analyzers/lint_analyzer/rules/rule_utils_test.dart index d1e3cce3..c5809e49 100644 --- a/test/src/analyzers/lint_analyzer/rules/rule_utils_test.dart +++ b/test/src/analyzers/lint_analyzer/rules/rule_utils_test.dart @@ -16,7 +16,7 @@ void main() { () { const id = 'rule-id'; final documentationUrl = Uri.parse( - 'https://dcl.apps.bancolombia.com/rules/flutter/rule-id', + 'https://dcl.apps.bancolombia.com/docs/rules/flutter/rule-id', ); const severity = Severity.none; @@ -72,7 +72,7 @@ void main() { expect( documentation(rule1).toString(), equals( - 'https://dcl.apps.bancolombia.com/rules/flutter/$ruleId1', + 'https://dcl.apps.bancolombia.com/docs/rules/flutter/$ruleId1', ), ); diff --git a/test/src/analyzers/lint_analyzer/rules/rules_list/list_all_equatable_fields/list_all_equatable_fields_rule_test.dart b/test/src/analyzers/lint_analyzer/rules/rules_list/list_all_equatable_fields/list_all_equatable_fields_rule_test.dart index e17a1745..219f8e09 100644 --- a/test/src/analyzers/lint_analyzer/rules/rules_list/list_all_equatable_fields/list_all_equatable_fields_rule_test.dart +++ b/test/src/analyzers/lint_analyzer/rules/rules_list/list_all_equatable_fields/list_all_equatable_fields_rule_test.dart @@ -22,7 +22,7 @@ void main() { expect( documentationUri.path, - equals('/docs/individuals/rules/common/list-all-equatable-fields'), + equals('/docs/rules/dart/list-all-equatable-fields'), ); }); diff --git a/test/src/config_builder/analysis_options_utils_test.dart b/test/src/config_builder/analysis_options_utils_test.dart index 15779b77..c9a9064f 100644 --- a/test/src/config_builder/analysis_options_utils_test.dart +++ b/test/src/config_builder/analysis_options_utils_test.dart @@ -45,7 +45,7 @@ const _merged = { }; void main() { - group('', () { + group('analysis_options_utils', () { test('isIterableOfStrings checks type of provided object', () { expect(isIterableOfStrings(null), isFalse); expect(isIterableOfStrings(Object()), isFalse); diff --git a/tools/analyzer_plugin/pubspec.yaml b/tools/analyzer_plugin/pubspec.yaml index 71ece8e5..426bc572 100644 --- a/tools/analyzer_plugin/pubspec.yaml +++ b/tools/analyzer_plugin/pubspec.yaml @@ -1,12 +1,12 @@ name: dart_code_linter_plugin_loader description: This pubspec determines the version of the analyzer plugin to load. -version: 1.1.2 +version: 1.1.3 environment: sdk: ">=2.14.0 <3.0.0" dependencies: - dart_code_linter: 1.1.2 + dart_code_linter: 1.1.3 dev_dependencies: lints: ^1.0.1