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

Run standardrb on a subdirectory #21

Closed
wjessop opened this issue Sep 20, 2024 · 5 comments · Fixed by #22
Closed

Run standardrb on a subdirectory #21

wjessop opened this issue Sep 20, 2024 · 5 comments · Fixed by #22

Comments

@wjessop
Copy link
Contributor

wjessop commented Sep 20, 2024

A client has their Rails app contained in a subdirectory of a monorepo and not the root:

root/
├── terraform/
├── cats/
│   └─── gifs/
└── rails_apps/
    ├── widgets_app/
    │   ├── .github/
    │   │   ├── standardrb.yml
etc.

would an option to run standardrb in a subdirectory be possible?

@searls
Copy link
Contributor

searls commented Sep 20, 2024

How does RuboCop handle it? I think the right answer is probably to mirror them

@wjessop
Copy link
Contributor Author

wjessop commented Sep 21, 2024

Rubocop takes a list of files:

% rubocop -h          
Usage: rubocop [options] [file1, file2, ...]

Basic Options:
…

It seems that Rubocop will take a directory too and run on all files contained within it and it's subdirectories:

% pwd
root/
% rubocop rails_apps/widgets_app
<robocop runs on all files in all subdirs of rails_apps/widgets_app>

However, it seems I've got Rubocop in my $PATH as it's not possible to bundle exec (the Gemfile is in rails_apps/widgets_app and not in the root of the repo which means that bundle exec standardrb --fix will not work there either:

% bundle exec rubocop rails_apps/widgets_app
Could not locate Gemfile or .bundle/ directory

The alternative would be to do something like reviewdog/action-rubocop and to allow specifying a workdir in the action that we could either cd to before running bundle exec …, or pushd/popd around to maintain the working directory.

@searls
Copy link
Contributor

searls commented Sep 21, 2024

Yeah, I'd shop around to look at a few other linter actions on github and see if there's a consensus name for this, but it sounds like a working directory config option is the best bet

@wjessop
Copy link
Contributor Author

wjessop commented Sep 23, 2024

It looks like somehow the release has regressed to v1 when it should probably be v1.4 : https://github.com/standardrb/standard-ruby-action/tags

@searls
Copy link
Contributor

searls commented Sep 23, 2024

@wjessop my bad, that's what I get for forgetting to update the CHANGELOG. Thought we were on 1.3

(It's almost like the versioning system for github actions of constantly moving tags around isn't ideal)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants