Skip to content
This repository has been archived by the owner on Sep 28, 2024. It is now read-only.

Spelling #189

Merged
merged 13 commits into from
Sep 11, 2024
Merged

Spelling #189

merged 13 commits into from
Sep 11, 2024

Conversation

jsoref
Copy link
Contributor

@jsoref jsoref commented Jun 5, 2024

Fixes misspellings identified by the check-spelling action.

The misspellings have been reported at https://github.com/jsoref/dart-lang-gcloud/actions/runs/9384457435#summary-25840295860

The action will report that the changes in this PR would make it happy: https://github.com/jsoref/dart-lang-gcloud/actions/runs/9384457462#summary-25840295798

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
Comment on lines 255 to 257
static const FilterRelation GreatherThan = FilterRelation._('>');
static const FilterRelation GreaterThan = FilterRelation._('>');
// ignore: constant_identifier_names
static const FilterRelation GreatherThanOrEqual = FilterRelation._('>=');
static const FilterRelation GreaterThanOrEqual = FilterRelation._('>=');
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably an api change.

static const OrderDirection Decending = OrderDirection._('Decending');
static const OrderDirection Descending = OrderDirection._('Descending');
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably an api change.

@@ -441,7 +441,7 @@ void runTests(Datastore datastore, String? namespace) {
});
});

// This should not work with [unamedEntities20], but is working!
// This should not work with [unnamedEntities20], but is working!
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could be wrong...

@devoncarew
Copy link
Contributor

@isoos, @sigurdm, @jonasfj for review

If we keep the API change spelling fixes, we'd want to bump the package version to 0.9.0.

@jsoref
Copy link
Contributor Author

jsoref commented Sep 10, 2024

If it helps, I'm happy to split those changes into a second PR.

@@ -252,9 +252,9 @@ class FilterRelation {
// ignore: constant_identifier_names
static const FilterRelation LessThanOrEqual = FilterRelation._('<=');
// ignore: constant_identifier_names
static const FilterRelation GreatherThan = FilterRelation._('>');
static const FilterRelation GreaterThan = FilterRelation._('>');
Copy link
Contributor

@jonasfj jonasfj Sep 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't we keep the old name as well, then it's not a breaking change.
We can even:

  • Mark the old field name as deprecated so that people using it get a warning.
  • Use the @nodoc annotation in a documentation comment so that it doesn't have to be displayed in the generated documentation.
Suggested change
static const FilterRelation GreaterThan = FilterRelation._('>');
static const FilterRelation GreaterThan = FilterRelation._('>');
/// Old misspelled name for [GreaterThan], retained for compatibility.
///
/// @nodoc
@Deprecated('Use FilterRelation.GreaterThan instead')
// ignore: constant_identifier_names
static const FilterRelation GreatherThan = GreaterThan;

If we are really bold, we could take a step further and try to use data driven fixes.
We'd simply create a lib/fix_data.yaml file which says how to rename.

version: 1
transforms:
  - title: 'Rename to GreaterThan'
    date: 2024-09-11
    element:
      uris: ['datastore.dart']
      field: 'GreatherThan'
      inClass: 'FilterRelation'
    changes:
      - kind: 'rename'
        newName: 'GreaterThan'

Then someone running dart fix --apply will get:

$ dart fix --apply
Computing fixes in gcloud...   2.1s
Applying fixes...                      0.0s

lib/src/datastore_impl.dart
  deprecated_member_use_from_same_package • 1 fix

test/datastore/e2e/datastore_test_impl.dart
  deprecated_member_use_from_same_package • 1 fix

2 fixes made in 2 files.

And a git diff as follows:

diff --git a/lib/src/datastore_impl.dart b/lib/src/datastore_impl.dart
index d62868c..ac976c7 100644
--- a/lib/src/datastore_impl.dart
+++ b/lib/src/datastore_impl.dart
@@ -205,7 +205,7 @@ class DatastoreImpl implements datastore.Datastore {
     datastore.FilterRelation.LessThan: 'LESS_THAN',
     datastore.FilterRelation.LessThanOrEqual: 'LESS_THAN_OR_EQUAL',
     datastore.FilterRelation.Equal: 'EQUAL',
-    datastore.FilterRelation.GreatherThan: 'GREATER_THAN',
+    datastore.FilterRelation.GreaterThan: 'GREATER_THAN',
     datastore.FilterRelation.GreatherThanOrEqual: 'GREATER_THAN_OR_EQUAL',
   };

diff --git a/test/datastore/e2e/datastore_test_impl.dart b/test/datastore/e2e/datastore_test_impl.dart
index 120ec5e..4e764df 100644
--- a/test/datastore/e2e/datastore_test_impl.dart
+++ b/test/datastore/e2e/datastore_test_impl.dart
@@ -780,7 +780,7 @@ void runTests(Datastore datastore, String? namespace) {
       assert(indexedEntity.length == 1);

       var filters = [
-        Filter(FilterRelation.GreatherThan, queryKey, queryLowerBound),
+        Filter(FilterRelation.GreaterThan, queryKey, queryLowerBound),
         Filter(FilterRelation.LessThan, queryKey, queryUpperbound),
       ];
       var listFilters = [

I think this is worth splitting out into a separate PR, just because doing these renames is somewhat non-trivial.

However, doing them without breaking the API is really cool. And being able to have the changes fixed with dart fix --apply is AWESOME 🚀

This was my first time trying to make a data driven fix, but it was surprisingly easy!

It's a bit sad that the data driven fix didn't show up in the "quick fix" menu offered in vscode by the LSP. Maybe, that'll happen one day.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could file a ticket against them 😉

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Split into #193

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, actually the documentation says that lib/fix_data.yaml is used for quick fixes.

Not sure why it doesn't work, maybe the lint doesn't trigger it, or?

At-least there is an issue for adding testings for it:
dart-lang/sdk#53768

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/flutter/flutter/blob/9108b6d0cff1eb95377153559c01d48f725760ba/docs/contributing/Data-driven-Fixes.md?plain=1#L93

The version key is required. The value of the version key is an integer used to identify the version of the file's content. The version described by this document is version 1. The version key is typically the first line of the file.

I can't tell if they mean that the version of the file format or the version of the file's content. While the text says the latter, it feels like it means the former, unless by document it means example file.

-- I'm happy to file PRs to places, but won't until I have a better understanding of the magic involved.

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
@jonasfj jonasfj merged commit eee174c into dart-archive:master Sep 11, 2024
3 checks passed
@jsoref jsoref deleted the spelling branch September 11, 2024 12:38
devoncarew pushed a commit to dart-lang/labs that referenced this pull request Sep 27, 2024
* spelling: available

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: comparison

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: item

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: its

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: keys

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: nonexistent

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: occurred

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: returns

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: scope

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: service

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: this

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: unnamed

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* spelling: useful

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

---------

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants