Skip to content
This repository has been archived by the owner on Aug 18, 2023. It is now read-only.

style: add linting #4

Closed
2 tasks
madiedgar opened this issue Sep 26, 2019 · 7 comments · Fixed by #10
Closed
2 tasks

style: add linting #4

madiedgar opened this issue Sep 26, 2019 · 7 comments · Fixed by #10

Comments

@madiedgar
Copy link
Member

madiedgar commented Sep 26, 2019

Linting

Being able to have formatted code that is aligned with the style guide will be important in the future. However, this might take additional time to make sure the linters apply to "Legesher" grammar and not just "Python" or "Javascript" grammar.

This quote from stack overflow gives a good explanation of the different attributes we will touch on:

EditorConfig: This helps your editor produce code that looks like your style guide as you go. While this isn't strictly necessary in order to achieve your goals, it's nice if you're always looking at code that follows the same coding styles. Otherwise if you don't have EditorConfig, as you're typing your editor will auto-format differently to the rest of the code base, which is confusing. Of course if you've set up prettier it'll fix it before it goes into your code base, but still, why would you want to look at it in one format while you're writing it and then have it switch when you go to commit? Might as well be consistent.

Prettier: Automatically formats your code. I like to set it up to do this when I stage my files for a commit, so that it's physically impossible for me to commit code that doesn't match my style guide.

ESLint: So why would you want a linter too? Because ESLint does more than just style. It picks up when you declare variables you don't use, or reference things that aren't defined, amongst a few other niceties. So while its role diminishes somewhat compared to the days before prettier, it's still useful to have in a project to catch the other errors.

This will eventually need a larger discussion of adopting best coding practices per programming language. Note: this repository already has coffeescript linting and contains coffeescript + python. But for now, let's start with the following:

  • Confirm all the coffeescript files are properly linted
  • Add linting rules for the python files
@rajitha1998
Copy link
Contributor

Hi, how can I contribute for this issue?

@madiedgar
Copy link
Member Author

Thanks @rajitha1998 so much for the desire to contribute to this project! We're wanting to create a consistent code styling for this repository so contributing to the project in the future is easier. I can update the issue description to give you a little more context and we can go through it together. Would you like to take this on? 😄

@rajitha1998
Copy link
Contributor

yes I would like to take this task :) . can you give more details about this @madiedgar

@rajitha1998
Copy link
Contributor

Hi @madiedgar I thought of using pylint in-order to lint python files. But for this we need to install this python library. I think we should create a setup.py for it. The .pylintrc is used to override the default configuration which is same as the coffeelint.json file. I have added a sample configuration file which has been used by another opensource project(can change it if you want a different configuration). I tried to check whether the coffeescript files are properly linted but the npm readme file has not enough information on how to run it. Also there website is not working http://www.coffeelint.org so I was unable to find information on that .

@madiedgar
Copy link
Member Author

Thank you so much for the thoughtfulness in your approach @rajitha1998! I'll look into your pull request and maybe we can find some more solutions 👍

@rajitha1998
Copy link
Contributor

looking forward for reviewing my PR. I'm open for any chamges :) @madiedgar

@lock
Copy link

lock bot commented May 20, 2020

⚠️This issue has been automatically locked 🔒since there has not been any recent activity after it was closed. Please open a new 🆕issue for related bugs and mention this issue. Thanks! 👍

@lock lock bot locked as resolved and limited conversation to collaborators May 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants