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

Make linting failure message more clear #34497

Merged
merged 1 commit into from
Oct 8, 2019

Conversation

anothersimulacrum
Copy link
Member

Summary

SUMMARY: None

Purpose of change

Make it more clear what is wrong when a file is not linted.

Describe the solution

Add a line that says '$FILENAME needs to be linted' to the output when a file is not linted.

Describe alternatives you've considered

Not doing this, as it can indicate that the contributor hasn't read the JSON style guide.

@Night-Pryanik
Copy link
Contributor

Then maybe remove "Formatted foo.json" line? It only confuses, as for me.

Right now when a json file is not linted, the program just says
'Formatted $FILENAME' and exits - this doesn't make it particularly
clear what is wrong when a file is not linted.
This aims to make it more clear for new contributors.
@anothersimulacrum
Copy link
Member Author

Done.

@@ -203,7 +203,7 @@ int main( int argc, char *argv[] )
std::ofstream fout( filename, std::ios::binary | std::ios::trunc );
fout << out.str();
fout.close();
std::cout << "Formatted " << filename << std::endl;
std::cout << filename << " needs to be linted" << std::endl;
Copy link
Contributor

@Davi-DeGanne Davi-DeGanne Oct 6, 2019

Choose a reason for hiding this comment

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

Regarding

Not doing this, as it can indicate that the contributor hasn't read the JSON style guide.

Might I suggest explicitly mentioning this in the failure text? Some users may not even know the style guide exists.

Suggested change
std::cout << filename << " needs to be linted" << std::endl;
std::cout << filename << " needs to be linted"
"\nPlease read doc/JSON_STYLE.md" << std::endl;

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh, I didn't see this, sorry.
I don't have any problems doing it
Though I would have done

Suggested change
std::cout << filename << " needs to be linted" << std::endl;
std::cout << filename << " needs to be linted" << std::endl;
std::cout << "Please read doc/JSON_STYLE.md" << std::endl;

If you'd like to PR it, feel free.

Copy link
Contributor

Choose a reason for hiding this comment

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

No worries. And fair enough, that is way cleaner.

@ZhilkinSerg ZhilkinSerg added Code: Build Issues regarding different builds and build environments Other Things that can't be classified anywhere else labels Oct 7, 2019
@ZhilkinSerg ZhilkinSerg merged commit b8d99bc into CleverRaven:master Oct 8, 2019
@anothersimulacrum anothersimulacrum deleted the lint-clearer branch October 8, 2019 14:46
Davi-DeGanne pushed a commit to Davi-DeGanne/Cataclysm-DDA that referenced this pull request Oct 9, 2019
To inform new contributors of the existance of the style guide
expands on CleverRaven#34497
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code: Build Issues regarding different builds and build environments Other Things that can't be classified anywhere else
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants