Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

export 'package:github/src/const/language_color.dart'; #232

Merged
merged 3 commits into from
Oct 7, 2020
Merged

export 'package:github/src/const/language_color.dart'; #232

merged 3 commits into from
Oct 7, 2020

Conversation

LefebvreIlyas
Copy link
Contributor

@LefebvreIlyas LefebvreIlyas commented Sep 21, 2020

minor improvements
rename languagesColor to kGitHubLanguageColors
export 'package:github/src/const/language_color.dart';
run language_color_generator.dart

export 'package:github/src/const/language_color.dart';
run language_color_generator.dart
export 'package:github/src/const/language_color.dart';
run language_color_generator.dart
@LefebvreIlyas
Copy link
Contributor Author

@robrbecker can you review please ?

Copy link
Member

@robrbecker robrbecker left a comment

Choose a reason for hiding this comment

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

Thanks for putting up a PR! Everything looks good except for the naming of the variable that is now exported publicly.


const languagesColor = <String, String>{
const kGitHubLanguageColors = <String, String>{
Copy link
Member

Choose a reason for hiding this comment

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

Why the rename here? This name feels a bit Java. Would you be ok with just languageColors ?

Suggested change
const kGitHubLanguageColors = <String, String>{
const languageColors = <String, String>{

Copy link
Contributor Author

@LefebvreIlyas LefebvreIlyas Oct 3, 2020

Choose a reason for hiding this comment

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

Hello Rob thanks a lot for the review!

I used this name to comply with the Flutter naming conventions. (See here).

Here is the more general naming convention for Dart.

I also prefixed it with GitHub to make it clearer.

So what do you prefer languagesColor or gitHubLanguageColors or githubLanguageColors ?

Copy link
Member

Choose a reason for hiding this comment

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

I'm more familiar with the Dart style guide and hadn't seen the Flutter style guide that recommends the leading k. In the Dart style guide it recommends not including prefix letters https://dart.dev/guides/language/effective-dart/style#dont-use-prefix-letters and I'd prefer that approach since it keeps naming consistent with the rest of this library.
I prefer languageColors since I feel that adding github is redundant in a library named github, especially if you use a named import like

import 'package:github/github.dart' as github;
// ...
print(github.languageColors['JavaScript']);

Copy link
Member

Choose a reason for hiding this comment

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

Also note the change of location of the s from
languagesColor to
languageColors

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@@ -46,4 +46,5 @@ export 'package:github/src/common/util/oauth2.dart';
export 'package:github/src/common/util/pagination.dart';
export 'package:github/src/common/util/service.dart';
export 'package:github/src/common/util/utils.dart';
export 'package:github/src/const/language_color.dart';
Copy link
Member

Choose a reason for hiding this comment

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

Just a note, but now that this file is being exported, the language color map is now considered part of the public API and should be non-breaking in future changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes!

final stringBuffer = StringBuffer()
..writeln('// GENERATED CODE - DO NOT MODIFY BY HAND')
..writeln('// VERSION OF ${DateTime.now().toIso8601String()}')
..writeln()
..writeln('const languagesColor = <String, String>{');
..writeln('const kGitHubLanguageColors = <String, String>{');
Copy link
Member

Choose a reason for hiding this comment

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

let's keep the name the same as above whatever we end up deciding

Suggested change
..writeln('const kGitHubLanguageColors = <String, String>{');
..writeln('const languageColors = <String, String>{');

Copy link
Contributor Author

@LefebvreIlyas LefebvreIlyas Oct 3, 2020

Choose a reason for hiding this comment

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

Done.

run language_color_generator.dart
@robrbecker robrbecker merged commit 5fd1b31 into SpinlockLabs:master Oct 7, 2020
@robrbecker
Copy link
Member

released in 7.0.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants