Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@german1608
Copy link
Contributor

@german1608 german1608 commented Oct 23, 2022

Resolves #67

Additional tasks

  • Documentation for changes provided/changed

    (no docs added since I'm unsure of the final signature of need)

  • Tests added
  • Updated CHANGELOG.md

    (should I do this?)

@german1608 german1608 changed the title Remove required tools from settings adt Remove the cmd parameter from Tool, and cliEnvSettingsRequiredTools Oct 23, 2022
@german1608 german1608 changed the title Remove the cmd parameter from Tool, and cliEnvSettingsRequiredTools Remove the cmd parameter from Tool, and cliEnvSettingsRequiredTools from CliEnvSettings Oct 23, 2022
@german1608 german1608 force-pushed the remove-required-tools-from-settings-adt branch from 60ef1a3 to 4b33bbc Compare October 23, 2022 19:14
@german1608 german1608 marked this pull request as ready for review October 23, 2022 19:15
@german1608 german1608 requested a review from chshersh as a code owner October 23, 2022 19:15
src/Iris/Tool.hs Outdated
__Throws:__ 'ToolCheckException' if can't find a tool or if it has wrong version.
@since 0.0.0.0
-}
need :: [Tool] -> IO ()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't know if this is the best signature for the need function. Maybe we should add a MonadIO m constraint? Let me know, please :)

Copy link
Owner

Choose a reason for hiding this comment

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

Agree, let's actually have MonadIO m => constraint here. This function is supposed to be called from inside the custom monad, so having the MonadIO constraint allows us to do this easily without the need to call liftIO.

@german1608 german1608 force-pushed the remove-required-tools-from-settings-adt branch from 4b33bbc to 76c97a2 Compare October 23, 2022 19:19
@chshersh chshersh added the hacktoberfest-accepted https://hacktoberfest.com/participation/ label Oct 24, 2022
@chshersh chshersh added enhancement New feature or request refactoring Improving code quality, reducing tech debt labels Jan 8, 2023
Copy link
Owner

@chshersh chshersh left a comment

Choose a reason for hiding this comment

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

Hi @german1608 👋🏻

There's one minor change in the API of need but the rest of the PR looks great 🙂

Happy to merge the PR after making this change and rebasing on top of the latest main branch.

src/Iris/Tool.hs Outdated
__Throws:__ 'ToolCheckException' if can't find a tool or if it has wrong version.
@since 0.0.0.0
-}
need :: [Tool] -> IO ()
Copy link
Owner

Choose a reason for hiding this comment

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

Agree, let's actually have MonadIO m => constraint here. This function is supposed to be called from inside the custom monad, so having the MonadIO constraint allows us to do this easily without the need to call liftIO.

Comment on lines +41 to +54
it "should fail when 'need'ing not found tools" $ do
let tool = "xxx_unknown_executable"
let expectedExceptionSel (err :: ToolCheckException) = case err of
ToolCheckException (ToolNotFound e) -> e == tool
_other -> False

need [Tool tool Nothing] `shouldThrow` expectedExceptionSel

it "should fail when 'need'ing tools with wrong version" $ do

let expectedExceptionSel (err :: ToolCheckException) = case err of
ToolCheckException (ToolWrongVersion _) -> True
_other -> False
need [ghc100] `shouldThrow` expectedExceptionSel
Copy link
Owner

Choose a reason for hiding this comment

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

Thanks for adding extra tests! 👏🏻

@german1608 german1608 force-pushed the remove-required-tools-from-settings-adt branch from 76c97a2 to 5e758c9 Compare January 13, 2023 18:00
Copy link
Owner

@chshersh chshersh left a comment

Choose a reason for hiding this comment

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

Awesome!

@chshersh chshersh merged commit 3454956 into chshersh:main Jan 16, 2023
@chshersh chshersh changed the title Remove the cmd parameter from Tool, and cliEnvSettingsRequiredTools from CliEnvSettings [#67] Remove the cmd parameter from Tool, and cliEnvSettingsRequiredTools from CliEnvSettings Jan 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request hacktoberfest-accepted https://hacktoberfest.com/participation/ refactoring Improving code quality, reducing tech debt

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rethink 'CliEnvSettings' and 'defaultCliEnvSettings'

2 participants