OOZOU
ติดต่อเรา
Back to TIL
ruby on rails

Ignore bundled gems for Rubocop and ESLint in GitHub Actions

19 มกราคม 2565

Rails projects will often install gems into the vendor directory in GitHub actions so we can cache them for the consecutive runs.

If you use code linters in the action you need to exclude the vendor/bundle/\* to prevent false positives

For ESLint this can be configured through ignorePatterns

// ./.eslintrc.json
{
  "ignorePatterns": [
    "vendor/bundle/*"
  ]
}

For Rubocop you can exclude through the AllCops config

# ./.rubocop.yml
AllCops:
  Exclude:
    - 'vendor/**/*'

Importance of Ignoring Bundled Gems in Code Linters

In software development, maintaining high code quality is essential. Code linters are a tool to help achieve this by performing static code analysis, which can detect potential errors and enforce a consistent coding style. However, when using linters in a continuous integration environment, such as GitHub Actions, it's crucial to configure them correctly to avoid false positives.

Bundled gems, often stored in the vendor directory, are external code dependencies that can be flagged by code linters if not properly excluded. By ignoring these directories, you can ensure that the linter focuses on your source code rather than external libraries, thus maintaining the integrity of your code analysis.

Configuring Linters to Exclude Bundled Gems

For JavaScript projects using ESLint, you can configure the linter to ignore the vendor/bundle/* directory through the ignorePatterns setting in your .eslintrc.json file. This ensures that only your code is checked, improving code quality without unnecessary distractions.

// ./.eslintrc.json
{
  "ignorePatterns": [
    "vendor/bundle/*"
  ]
}

Similarly, for Ruby projects using Rubocop, you can exclude the vendor directory by adding an Exclude rule under AllCops in your .rubocop.yml configuration file. This helps focus the static code analysis on your actual source code.

# ./.rubocop.yml
AllCops:
  Exclude:
    - 'vendor/**/*'

By configuring your code linters to exclude bundled gems, you can maintain a high standard of code quality while avoiding false positives in your static code analysis.

#RUBY-ON-RAILS

More on ruby on rails

ruby on rails10 กุมภาพันธ์ 2565

Use Pundit Policies to manage permitted parameters, defaults and per action

To manage permitted params you can add permitted\attributes and permitted\attributes\for\#{action} in your policies e.g.

ruby on rails31 มกราคม 2565

Use `requestSubmit` for form submits with Turbo

Turbo listens to submit events on form.  Hence, always use requestSubmit to submit  a form using JS.

ruby on rails18 เมษายน 2564

Rails 6, Ruby 3, Bootstrap 5 and Hotwire

Extending the blogpost from Bootrails with Hotwire: All the fancy new things (as of when I'm writing this TIL):

มีโปรเจกต์ในใจ?

เรายินดีรับฟังสิ่งที่คุณกำลังสร้าง

เริ่มต้นสนทนาhello@oozou.com
OOZOU Logo

กรุงเทพฯ · สิงคโปร์ · ฮ่องกง

X
Facebook
Instagram
LinkedIn

บริการ

  • พัฒนาเว็บ
  • AI และ Generative AI
  • พัฒนาแอปมือถือ
  • การวิเคราะห์และวิศวกรรมข้อมูล
  • ออกแบบ UI/UX และผลิตภัณฑ์
  • การเปลี่ยนแปลงทางดิจิทัล

บริษัท

  • เกี่ยวกับเรา
  • ร่วมงานกับเรา
  • บล็อก
  • เอกสารวิชาการ
  • กรณีศึกษา
  • Today I Learned
  • ติดต่อเรา

เพิ่มเติม

  • อุตสาหกรรม
  • ขอใบเสนอราคา
  • เครือข่ายพันธมิตร
© 2026 OOZOU สงวนลิขสิทธิ์
นโยบายความเป็นส่วนตัวจรรยาบรรณนโยบาย ABAC