-
Notifications
You must be signed in to change notification settings - Fork 10
Code
We have different linters in place checking for style guideline violations (also in our CI/CD pipeline for every PR). Most of the linters are directly available and ready to use if you install the recommended extensions in the VSCode marketplace (we've set up the recommendations specifically for MaMpf).
TODO: refer to justfile with many commands
The backend of MaMpf is written in Ruby on Rails. Custom linting rules are defined in rubocop.yml
.
- Install the recommended
Ruby LSP
extension and you'll be ready to lint any.rb
file.
Troubleshooting:
- Try to run the
Ruby LSP: Restart
command. - See the output of the plugin in the
Output
pane (choose "Ruby LSP" in the dropdown).
We use ESLint to lint .js
and .js.erb
files. In our CI/CD, we check for style guideline violations, so make sure to always submit already linted code. If you don't use VSCode, you can use the command line, i.e. yarn run eslint --fix ./your-file.js
, or the respective ESLint extension/plugin in other IDEs. We provide the respective config file in the project root (.eslintrc.js
).
- Install the ESLint extension on the marketplace (filter for the recommended extensions we set up).
- Install the necessary node modules:
yarn install
(this includes theeslint
npm package and some other related packages that are necessary). - Open any
.js
or.js.erb
file, change something (e.g. remove a semicolon) and save the file. ESLint will automatically lint it. You can also use theFormat Document
command in the command palette.
Troubleshooting
- Try to run the
ESLint: Restart ESLint Server
command. - See the output of the plugin in the
Output
pane (choose "ESLint" in the dropdown).
Some overviews over the (fairly big) MaMpf code base.
- Annotation tool & Thyme player (frontend): Thyme overview
- Suggestions for Just:
- Rails Sandbox
- Reset the database to the prepopulated one
Things that would have saved some / a lot of time if I/we had known them before (as newcomer to Ruby on Rails).
-
Exclamation mark:
.select
vs..select!
. Be aware of the difference between.select
andselect!
or.save
and.save!
etc. With the additional!
, it's a convention that the method will modify the original argument. And the return type is different too!.select!
returnsnil
if no changes were made. Writinga = some_array.select! do ... end
will therefore result in behavior you have probably not intended. Use.select
in this case instead. Occurred here