Skip to content

Commit 7903c52

Browse files
committed
fix: remove unnecessary changes and add missing docs
1 parent f8dad3c commit 7903c52

File tree

4 files changed

+40
-22
lines changed

4 files changed

+40
-22
lines changed

.github/workflows/bot_updater.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
uses: peter-evans/create-pull-request@v7.0.8
4646
with:
4747
base: main
48-
branch: chore/update-spdx-license
48+
branch: chore/update-exclusion-table
4949
commit-message: "docs: update exclusion table"
5050
title: "docs: update exclusion table"
5151
body: |
@@ -68,9 +68,9 @@ jobs:
6868
uses: peter-evans/create-pull-request@v7.0.8
6969
with:
7070
base: main
71-
branch: chore/remove-deprecated-rules
72-
commit-message: "fix: remove deprecated rules"
73-
title: "fix: remove deprecated rules"
71+
branch: feat/remove-deprecated-rules
72+
commit-message: "feat: remove deprecated rules"
73+
title: "feat: remove deprecated rules"
7474
body: |
7575
There are now rules deprecated that require an update to the Very Good Analysis.
7676
labels: bot

tool/bump_version/lib/bump_version.dart

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
/// This script will:
44
/// - Copy the most recent yaml to a new one with the new desired version.
55
/// - Include that file on the main yaml file `lib/analysis_options.yaml.
6-
/// - Bump the version of the Very Good Analysis package in the pubspec.yaml.
76
///
87
/// ## Usage
98
///
@@ -36,9 +35,7 @@ void main(List<String> args) => bumpVersion(args[0]);
3635

3736
/// Bumps the version of the analysis options file and the pubspec.yaml file.
3837
void bumpVersion(String newVersion, {String basePath = ''}) {
39-
final analysisOptionsFile = File(
40-
'${basePath}lib/analysis_options.yaml',
41-
);
38+
final analysisOptionsFile = File('${basePath}lib/analysis_options.yaml');
4239
final content = analysisOptionsFile.readAsStringSync();
4340
final latestVersion = _latestAnalysisVersionRegExp
4441
.firstMatch(content)
@@ -58,15 +55,4 @@ void bumpVersion(String newVersion, {String basePath = ''}) {
5855
'analysis_options.$newVersion.yaml',
5956
);
6057
analysisOptionsFile.writeAsStringSync(newContent);
61-
62-
final pubspecFile = File(
63-
'${basePath}pubspec.yaml',
64-
);
65-
final pubspecContent = pubspecFile.readAsStringSync();
66-
final newPubspecContent = pubspecContent.replaceFirst(
67-
'version: $latestVersion',
68-
'version: $newVersion',
69-
);
70-
71-
pubspecFile.writeAsStringSync(newPubspecContent);
7258
}

tool/linter_rules/README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,35 @@ dart bin/analyze.dart $version
6262
```
6363

6464
Where version is the existing Very Good Analysis version you would like to analyze, for example `9.0.0`.
65+
66+
67+
## Check and remove deprecated rules 🔍
68+
69+
The script `tool/linter_rules/bin/remove_deprecated_rules.dart` helps maintain Very Good Analysis by automatically handling deprecated linter rules.
70+
71+
This script will:
72+
73+
- Fetch the latest rules from the official Dart SDK
74+
- Identify any deprecated rules currently used in Very Good Analysis
75+
- Remove deprecated rules from the analysis options file by creating a new minor version of Very Good Analysis without the deprecated rules
76+
- Assign the new file as the latest version in lib/analysis_options.yaml
77+
- Add removed rules to the exclusion table with reason 'Deprecated'
78+
79+
### Usage
80+
81+
To check and remove deprecated rules, run the following command (from `tool/linter_rules`):
82+
83+
```sh
84+
dart bin/remove_deprecated_rules.dart
85+
```
86+
87+
88+
## Automations
89+
90+
There is a [GitHub workflow](../../.github/workflows/bot_updater.yaml) that automates the maintenance of the linter rules. This workflow runs on a schedule (every weekday) and can also be triggered manually.
91+
92+
It performs two main tasks:
93+
94+
1. **Update Exclusion Table**: It checks if there are any changes to the exclusion reasons for linter rules. If there are, it regenerates the exclusion table in this README and creates a pull request with the title `docs: update exclusion table`.
95+
96+
2. **Remove Deprecated Rules**: It checks for deprecated linter rules currently used in Very Good Analysis. If any are found, it automatically removes them from the analysis options, creates a new version of the analysis options file, and opens a pull request with the changes, titled `feat: remove deprecated rules`.

tool/linter_rules/bin/remove_deprecated_rules.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ import 'package:yaml_edit/yaml_edit.dart';
77
/// Removes deprecated rules from the analysis options file based on the
88
/// official Dart linter rules.
99
///
10-
/// It will create a new version of the analysis options file, bump the version
11-
/// in the pubspec.yaml, and update the exclusion reasons file and the
12-
/// table of excluded rules in the README.md file.
10+
/// It will create a new version of the analysis options file and update the
11+
/// exclusion reasons file and the table of excluded rules in the README.md
12+
/// file.
1313
Future<void> main({
1414
void Function(String) log = print,
1515
}) async {

0 commit comments

Comments
 (0)