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

Ruby Course: Add Rubocop / Linting Lesson #27091

Closed
3 of 9 tasks
JoshDevHub opened this issue Jan 8, 2024 Discussed in #25674 · 6 comments · Fixed by #27794
Closed
3 of 9 tasks

Ruby Course: Add Rubocop / Linting Lesson #27091

JoshDevHub opened this issue Jan 8, 2024 Discussed in #25674 · 6 comments · Fixed by #27794
Assignees
Labels
Content: Ruby Involves the Ruby course Status: Stale This issue/PR has been inactive for over 30 days and will be closed if inactivity continues

Comments

@JoshDevHub
Copy link
Contributor

Discussed in #25674

Originally posted by ChargrilledChook March 14, 2022

Complete the following REQUIRED checkboxes:

  • I have thoroughly read and understand The Odin Project Contributing Guide
  • The title of this issue follows the location for request: brief description of request format, e.g. NodeJS course: Add lessons on XYZ

The following checkbox is OPTIONAL:

  • I would like to be assigned this issue to work on it

1. Description of the Feature Request:

Rubocop is a very useful tool that is regularly recommended in Discord (as well as briefly introduced in the OOP section).

However, it is often also a source of confusion and questions in Discord, with many learners not understanding the difference between Rubocop the gem and the IDE integration. We also give very little context on how to read the output.

Introducing a lesson that covered topics such as installation and configuration, how to interpret / look up offenses on the community style guide and basic customization could provide a lot of value to learners, as well as provide parity with the linting lessons in the JS section.

2. Acceptance Criteria:
A lesson that covers:

  • Gem installation + IDE integration
  • Difference between CLI and IDE versions, visual examples
  • Brief explanation of linting
  • Intro to community style guide + difference between different types of rules (style, lint, performance etc)
  • Explanation of more confusing rules (such as ABC / cyclomatic complexity metrics)
  • How to write a custom .rubocop.yml / add plugins

3. Additional Information:

If the maintainers like this idea I'm happy to create a more detailed lesson outline for discussion and/or provide a draft.

@JoshDevHub JoshDevHub added the Content: Ruby Involves the Ruby course label Jan 8, 2024
@JoshDevHub JoshDevHub self-assigned this Jan 8, 2024
Copy link

github-actions bot commented Feb 8, 2024

This issue is stale because it has had no activity for the last 30 days.

@github-actions github-actions bot added the Status: Stale This issue/PR has been inactive for over 30 days and will be closed if inactivity continues label Feb 8, 2024
@JoshDevHub JoshDevHub removed their assignment Apr 6, 2024
@JoshDevHub
Copy link
Contributor Author

@scheals Gonna discuss the rubocop stuff here. I'll assign you to work on it.

Feel free to ask any questions you may have. I'll post some of my notes, ideas, and links here later when I'm booted back in my Ubuntu environment, although the "Acceptance Criteria" in the OP (originally written by Chook), hits most of the main points I was planning to go over.

@github-actions github-actions bot removed the Status: Stale This issue/PR has been inactive for over 30 days and will be closed if inactivity continues label Apr 7, 2024
@scheals
Copy link
Contributor

scheals commented Apr 12, 2024

Just giving a heads up that I'm slowly working on it :) Your notes, ideas and links would be very appreciated!

@JoshDevHub
Copy link
Contributor Author

JoshDevHub commented Apr 12, 2024

Thanks for reminding me of this @scheals

In looking at my notes, I had most of the things pointed out above in the Acceptance Critera for my outline.

I think one of the important things is introducing the idea of linting/formatting. Why is this important? Can borrow ideas from how this is done in the JavaScript course. Probably a good idea to link to an article or wikipedia page or something that explains what "linting" even is. I think some good points to hit on the "why" of it might include:

  • helps a team of developers achieve a more consistent style and formatting across the project
  • helps catch common errors before runtime (like a missing end, for example)
  • helps with integrating certain "good" practices. rubocop is nice about suggesting alternate ways to format nested conditionals for example.

I thought it'd be nice to have people create a new "project" or really a playground to install it and try things out. Gives people a place to practice with bundle init and adding things to the Gemfile. So maybe a little walk through doing that, have them add the rubocop gem, and then have them make a ruby file that has some blatant lint issues in it ie:

# linting_playground.rb

def badMethodDefinition a, b
  puts "This method definition has stylistic problems"
end

Then they could run the CLI against that and see the problems. Then maybe walk through how to integrate with VSCode and have the diagnostics show up in the IDE itself.

This was just my (unpolished) idea for introducing it. Feel free to ignore or change things lol.

That's about as far as I get with my thinking and development of this. Also think the Acceptance Critera in the original post has some important items to hit on (the style guide, rules that are difficult to understand, etc.)

Definitely let me know if you have any questions or just want feedback on any ideas or anything.

@scheals
Copy link
Contributor

scheals commented Apr 13, 2024

Cheers for this Josh. I've been eyeing the JS Linting lesson a little and so far have started to hit on those points I believe.

And as for the new "project" - in the WIP version I'm just getting folks to go back to their Caesar Cipher project. I am going to check like a dozen of such recently submitted projects to check if Rubocop picks up something in every single of them (I would expect that to be the case). This way they can improve something they've already worked on and it'll set the stage for the future test adding. So seems like great minds think alike :D

CLI -> VSC is my direction as well, especially since w/ VSC we've got the overhead of Ruby-LSP now and things might change.

Fingers crossed I have the first rough draft of the lesson finished by tomorrow.

Also, a mental note for both you and me:
Ruby-LSP VSC extension has moved to a monorepo, so we need to make sure our links in #27128 are updated.

Copy link

This issue is stale because it has had no activity for the last 30 days.

@github-actions github-actions bot added the Status: Stale This issue/PR has been inactive for over 30 days and will be closed if inactivity continues label May 14, 2024
JoshDevHub pushed a commit to TheOdinProject/theodinproject that referenced this issue May 24, 2024
## Because
It'd be cool to have those lessons.


## This PR
- Adds those lessons so they actually show up in the curriculum!


## Issue
Related:
- TheOdinProject/curriculum#27026
- TheOdinProject/curriculum#27091

## Additional Information
Please merge these first:
- TheOdinProject/curriculum#28040
- TheOdinProject/curriculum#28041

Also, for all the poor WSL2 souls that have failing rspec tests:
Do not follow Cliver error output. It won't be happy with a wslpath'd
Chrome on Windows side. At least, it wasn't in my case. Just install
Chrome in WSL2 and it'll be happy.

## Pull Request Requirements
- [x] I have thoroughly read and understand [The Odin Project
Contributing
Guide](https://github.com/TheOdinProject/theodinproject/blob/main/CONTRIBUTING.md)
- [x] The title of this PR follows the `keyword: brief description of
change` format, using one of the following keywords:
    - `Feature` - adds new or amends existing user-facing behavior
- `Chore` - changes that have no user-facing value, refactors,
dependency bumps, etc
    - `Fix` - bug fixes
-   [x] The `Because` section summarizes the reason for this PR
- [x] The `This PR` section has a bullet point list describing the
changes in this PR
- [x] I have verified all tests and linters pass after making these
changes.
- [x] If this PR addresses an open issue, it is linked in the `Issue`
section
-   [ ] If applicable, this PR includes new or updated automated tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content: Ruby Involves the Ruby course Status: Stale This issue/PR has been inactive for over 30 days and will be closed if inactivity continues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants