Giter Site home page Giter Site logo

commerce-backend's Introduction

Ruby on Rails Course

If you are not familiar with linters and GitHub Actions, read root level README.

Set-up GitHub Actions

This GitHub Action is going to run Rubocop and Stylelint to help you find style issues.

Stylelint is a linter for your stylesheets that helps you avoid errors and enforce conventions.

Rubocop is a Ruby static code analyzer (a.k.a. linter) and code formatter. It will enforce many of the guidelines outlined in the community Ruby Style Guide.

Please do the following steps in this order:

  1. In the first commit of your feature branch create a .github/workflows folder and add a copy of .github/workflows/linters.yml to that folder.
    • Remember to use the file linked above
    • Remember that .github folder starts with a dot.
  2. Do not make any changes in config files - they represent style guidelines that you share with your team - which is a group of all Microverse students.
  3. When you open your first pull request you should see the result of the GitHub Actions:

gh actions checks

Click on the Details link to see the full output and the errors that need to be fixed:

gh actions failing checks

Set-up linters in your local env

Note: The npm package manager is going to create a node_modules directory to install all of your dependencies. You shouldn't commit that directory. To avoid that, you can create a .gitignore file and add node_modules to it:

# .gitignore
node_modules/

Rubocop

  1. Add this line to the Gemfile
    gem 'rubocop', '>= 1.0', '< 2.0'
    
    not sure how to use Gemfile? Read this.
  2. Run bundle install.
  3. Copy .rubocop.yml to the root directory of your project
  4. Do not make any changes in config files - they represent style guidelines that you share with your team - which is a group of all Microverse students.
  5. Run rubocop.
  6. Fix linter errors.
  7. IMPORTANT NOTE: feel free to research auto-correct options for Rubocop if you get a flood of errors but keep in mind that correcting style errors manually will help you to make a habit of writing a clean code!

Stylelint

  1. Run

    not sure how to use npm? Read this.

  2. Copy .stylelintrc.json to the root directory of your project.

  3. Do not make any changes in config files - they represent style guidelines that you share with your tem - which is a group of all Microverse students.

  4. Run npx stylelint "**/*.{css,scss}" on the root of your directory of your project.

  5. Fix linter errors.

  6. IMPORTANT NOTE: feel free to research auto-correct options for Stylelint if you get a flood of errors but keep in mind that correcting style errors manually will help you to make a habit of writing a clean code!

RSpec/Heroku Actions

Feel free to add your own deployment actions which can run your tests and deploy to Heroku.

Make sure that you do not modify the .github/workflows/linters.yml but that you create a separe GitHub Action workflow file for that.

Troubleshooting

  • If you are building an API only Rails application For API only Rails application you can remove the Stylelint config. To do so remove line no. 23 to 36 from the linter.yml file.

commerce-backend's People

Contributors

hannziegel avatar lucas-crodrigues avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.