-
Notifications
You must be signed in to change notification settings - Fork 27
Remove use of module_function #150
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,15 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| # typed: strict | ||
|
|
||
| module CodeOwnership | ||
| module Private | ||
| module FilePathFinder | ||
| module_function | ||
|
|
||
| extend T::Sig | ||
| extend T::Helpers | ||
|
|
||
| # Returns a string version of the relative path to a Rails constant, | ||
| # or nil if it can't find anything | ||
| sig { params(klass: T.nilable(T.any(T::Class[T.anything], Module))).returns(T.nilable(String)) } | ||
| def path_from_klass(klass) | ||
| sig { params(klass: T.nilable(T.any(T::Class[T.anything], T::Module[T.anything]))).returns(T.nilable(String)) } | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| def self.path_from_klass(klass) | ||
| if klass | ||
| path = Object.const_source_location(klass.to_s)&.first | ||
| (path && Pathname.new(path).relative_path_from(Pathname.pwd).to_s) || nil | ||
|
|
@@ -23,7 +19,7 @@ def path_from_klass(klass) | |
| end | ||
|
|
||
| sig { params(backtrace: T.nilable(T::Array[String])).returns(T::Enumerable[String]) } | ||
| def from_backtrace(backtrace) | ||
| def self.from_backtrace(backtrace) | ||
| return [] unless backtrace | ||
|
|
||
| # The pattern for a backtrace hasn't changed in forever and is considered | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,4 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| # typed: strict | ||
|
|
||
| module CodeOwnership | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| # typed: false | ||
| # typed: strict | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is an easy type promotion 📈 |
||
| # frozen_string_literal: true | ||
|
|
||
| module CodeOwnership | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,3 @@ | ||
| --dir | ||
| . | ||
| --dir=. | ||
| --ignore=/spec | ||
| --ignore=/vendor/bundle | ||
| --enable-experimental-requires-ancestor |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,10 @@ | |
| let(:file_path) { 'app/javascript/[test]/test.js' } | ||
| let(:codes_team) { instance_double(CodeTeams::Team) } | ||
|
|
||
| before do | ||
| allow(codes_team).to receive(:is_a?).with(CodeTeams::Team).and_return(true) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is needed bc runtime typechecking is enabled as a result of removing |
||
| end | ||
|
|
||
| describe '.get' do | ||
| subject { described_class.get(file_path) } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A more recent release is necessary for
T::Moduleto resolve (see comment below).