Skip to content

Conversation

Stargator
Copy link
Contributor

Per #210, ran create_exercise to update anagram and add the version to pubspec.yaml

@Stargator Stargator self-assigned this Nov 11, 2019
@Stargator Stargator force-pushed the bump-anagram branch 2 times, most recently from 3e41449 to afb94eb Compare November 11, 2019 16:21
Copy link
Contributor

@devkabiir devkabiir left a comment

Choose a reason for hiding this comment

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

Couple of suggestions.

  • Prefer final and const whenever possible. If the variable isn't being reassigned, final and const make it clear at declaration level. However, these are not required for effective dart. There exists prefer_final_locals as well as unnecessary_final lint rules.
  • Prefer collection literals as per effective_dart style guidelines.

Since these should've been caught when they were introduced, This PR is unrelated, valid and approved.

test("no matches", () {
final List<String> result = anagram.findAnagrams("diaper", ["hello", "world", "zombies", "pants"]);
test('no matches', () {
final List<String> result = anagram.findAnagrams('diaper', <String>['hello', 'world', 'zombies', 'pants']);
Copy link
Contributor

Choose a reason for hiding this comment

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

<String> type annotation on the list literal is not required. findAnagrams only accepts List as it's second argument. Was this added by the create_exercise tool?

Copy link
Contributor

Choose a reason for hiding this comment

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

Same for rest of the list literals in this file.

Map<String, int> subjectCharsMap = countCharacters(subject);

List<String> matchTracker = new List<String>();
List<String> matchTracker = List<String>();
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
List<String> matchTracker = List<String>();
final List<String> matchTracker = [];

OR

Suggested change
List<String> matchTracker = List<String>();
final matchTracker = <String>[];

@Stargator Stargator merged commit 4427e17 into exercism:master Nov 16, 2019
@Stargator Stargator deleted the bump-anagram branch November 16, 2019 20:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants