Skip to content

Conversation

@bastelfreak
Copy link
Member

No description provided.

@bastelfreak bastelfreak self-assigned this Jun 9, 2024

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
Style/RedundantSort:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't #181 solve that?

# Interpret 3 as < 4
"< #{version.to_i + 1}"
else
# This would be the same as the strict requirement
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I originally wrote this because it explicitly documents the flow. Is it worth keeping that?

@bastelfreak bastelfreak merged commit 6913f88 into voxpupuli:master Jun 9, 2024
unless metadata['operatingsystem_support'].is_a? Array
fail StandardError, 'Unknown operatingsystem support in the metadata file!'
end
raise StandardError, 'Unknown operatingsystem support in the metadata file!' unless metadata['operatingsystem_support'].is_a? Array
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say this is less readable. Can we disable the guard condition cop?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unless File.file? metadata_file
fail StandardError, "Can't find metadata.json... dunno why"
end
raise StandardError, "Can't find metadata.json... dunno why" unless File.file? metadata_file
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

data = JSON.parse(fd.read)

version_map = data.map { |_, versions|
version_map = data.map do |_, versions|
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In #183 I do more refactoring that I think helps. I'd expect .map.compact to be flagged in rubocop-performance.

if augeas?
@common_facts[:augeasversion] = Augeas.open(nil, nil, Augeas::NO_MODL_AUTOLOAD).get('/augeas/version')
end
@common_facts[:augeasversion] = Augeas.open(nil, nil, Augeas::NO_MODL_AUTOLOAD).get('/augeas/version') if augeas?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not happy with the condition given the line length. AFAIK the guard condition cop supports line lengths, but we disabled that cop so the guard condition cop is too trigger happy.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 this pull request may close these issues.

2 participants