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

join: remove a clippy::cognitive_complexity by moving some content in functions #5367

Merged
merged 2 commits into from
Oct 16, 2023

Conversation

sylvestre
Copy link
Contributor

No description provided.

///
/// This function takes the matches from the command-line arguments, processes them,
/// and returns a `Settings` struct that encapsulates the configuration for the program.
fn parse_settings(matches: &clap::ArgMatches) -> UResult<Settings> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Unfortunately, the refactorings are not enough and the cognitive_complexity lint still shows a warning.

Suggested change
fn parse_settings(matches: &clap::ArgMatches) -> UResult<Settings> {
#[allow(clippy::cognitive_complexity)]
fn parse_settings(matches: &clap::ArgMatches) -> UResult<Settings> {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh, maybe we should break the clippy task on this too

Copy link
Contributor

Choose a reason for hiding this comment

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

Hm, what do you mean with "break the clippy task"? Currently, the lint still shows a warning.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

like this:
#5379

Copy link
Contributor

@cakebaker cakebaker Oct 11, 2023

Choose a reason for hiding this comment

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

Sorry, I still don't understand what you mean :| #5379 has been merged in the meantime and the CI shows an error for this PR (for some reason the job doesn't fail):

error: the function has a cognitive complexity of (12/10)
   --> src/uu/join/src/join.rs:622:4
    |
622 | fn parse_settings(matches: &clap::ArgMatches) -> UResult<Settings> {

src/uu/join/src/join.rs Outdated Show resolved Hide resolved
@cakebaker cakebaker merged commit ce0cf7a into uutils:main Oct 16, 2023
44 of 45 checks passed
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