whitesmith / whitesmith/rubycritic

Add XDG configuration

Open
#376 2 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
3.5k
Forks
234
PR merge metrics
No merged PRs in 30d

Description

Overview

I would like to propose using the the XDG specification for managing this gem's configuration which is a UNIX standard. Example:

# Global (default)
$HOME/.config/rubycritic/configuration.yml

# Local (alternative per project configuration -- Takes precedence over global configuration)
$HOME/projects/my_example/.config/rubycritic/configuration.yml

This can be easily solved by using the XDG gem as a dependency to this project. Even better, you can use the Runcom gem which is a superset of XDG for allowing users to have either a global and/or local configuration since XDG doesn't support local configurations by default.

Doing this work would resolve the following related issues:

Screenshots/Screencasts

Here's an example of ruby code used in the Rubysmith project to show how easy it would be to implement this:

image

💡 Associated source code can be found here.

Desired Behavior

By using Runcom, which is built on top of XDG, you'd get the following enhancements for free:

  • Checks to see if local configuration exists and loads it.
  • If local configuration doesn't exist, then it checks to see if global configuration exists and loads it.
  • If global configuration doesn't exist, then default Rubycritic configuration is loaded instead.

By doing this work, we'd have a way to remove .rubycritic.yml from the root of everyone's projects.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the referenced lib/rubysmith/cli/configuration.rb example and inspect how Rubycritic currently finds .rubycritic.yml. Verify the desired precedence of local configuration, global configuration, and defaults, then confirm that the root-level .rubycritic.yml can be removed without losing the related configuration behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.