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

Address all hlint suggestions #51

Closed
ivanperez-keera opened this issue Jul 21, 2022 · 5 comments
Closed

Address all hlint suggestions #51

ivanperez-keera opened this issue Jul 21, 2022 · 5 comments
Assignees
Labels
CR:Status:Closed Admin only: Change request that has been completed CR:Type:Management Admin only: Change request for conformance with policies or procedures
Milestone

Comments

@ivanperez-keera
Copy link
Member

Description

As part of our own internal testing and style guides, we recommend the use of different static analysis tools, which are currently reporting a number of suggestions. HLint is suggesting the use of newtype instead of data, and the removal of fmap id in a number of places.

We should address these issues, either by applying hlint's suggestion, or by adding annotations or configuration settings that make hlint ignore those cases.

Type

  • Management: conformance with testing / style guide.

Additional context

None.

Requester

  • Ivan Perez

Method to check presence of bug

The following bash command will print "Success" if there are no hlint suggestions, and nothing otherwise.

$ (for i in ogma-*; do cd $i; hlint --no-summary src/ ; cd ..; done | [ $(wc -c) -eq 0 ]) && echo Success

Expected result

The command above should print "Success".

Desired result

The command above should print "Success".

Proposed solution

Evaluate each suggestion, and either accept it or make hlint ignore it by modifying the .hlint.yaml file or adding an annotation to the code.

Further notes

None.

@ivanperez-keera ivanperez-keera added CR:Status:Initiated Admin only: Change request that has been initiated CR:Type:Management Admin only: Change request for conformance with policies or procedures labels Jul 21, 2022
@ivanperez-keera
Copy link
Member Author

Change Manager: Confirmed that the hlint suggestions are produced.

@ivanperez-keera ivanperez-keera added CR:Status:Confirmed Admin only: Change request that has been acknowledged by the change manager and removed CR:Status:Initiated Admin only: Change request that has been initiated labels Jul 21, 2022
@ivanperez-keera
Copy link
Member Author

Technical Lead: Confirmed that the issue should be addressed.

@ivanperez-keera ivanperez-keera added CR:Status:Accepted Admin only: Change request accepted by technical lead and removed CR:Status:Confirmed Admin only: Change request that has been acknowledged by the change manager labels Jul 21, 2022
@ivanperez-keera ivanperez-keera added this to the Release 1.1 milestone Jul 21, 2022
@ivanperez-keera
Copy link
Member Author

ivanperez-keera commented Jul 21, 2022

Technical Lead: Issue scheduled for fixing in Ogma 1.0.4.

Fix assigned to: @ivanperez-keera .

@ivanperez-keera ivanperez-keera added CR:Status:Scheduled Admin only: Change requested scheduled and removed CR:Status:Accepted Admin only: Change request accepted by technical lead labels Jul 21, 2022
@ivanperez-keera ivanperez-keera self-assigned this Jul 21, 2022
@ivanperez-keera ivanperez-keera added CR:Status:Implementation Admin only: Change request that is currently being implemented and removed CR:Status:Scheduled Admin only: Change requested scheduled labels Jul 21, 2022
ivanperez-keera added a commit to ivanperez-keera/ogma that referenced this issue Jul 21, 2022
We purposefully use data instead of newtype to make all related modules
as similar as possible. This is a conscious choice.

This commit adds rules to the hlint configuration files so that those
specific suggestions are ignored.
ivanperez-keera added a commit to ivanperez-keera/ogma that referenced this issue Jul 21, 2022
We purposefully use (id <$>) because conceptually there is a
transformation taking place, but in this case it would be the identity.
This is (almost) a coincidence, and may not be like that in the future.

We indicate this fact with the use of a transformation function in the
code, although such function in this case does nothing.

This commit adds an annotation so that hlint ignores that specific
suggestion, and a comment to explain the decision.
ivanperez-keera added a commit to ivanperez-keera/ogma that referenced this issue Jul 21, 2022
ivanperez-keera added a commit to ivanperez-keera/ogma that referenced this issue Jul 21, 2022
@ivanperez-keera
Copy link
Member Author

Change Manager: Verified that:

  • Solution is implemented:
    • The code proposed compiles passes the tests. Details:
      Docker image:

      FROM ubuntu:trusty
      
      RUN apt-get update
      
      RUN apt-get install --yes software-properties-common
      RUN add-apt-repository ppa:hvr/ghc
      RUN apt-get update
      
      RUN apt-get install --yes ghc-8.6.5 cabal-install-2.4
      RUN apt-get install --yes libz-dev
      
      ENV PATH=/opt/ghc/8.6.5/bin:/opt/cabal/2.4/bin:$PWD/.cabal-sandbox/bin:$PATH
      
      RUN cabal update
      RUN cabal v1-sandbox init
      RUN cabal v1-install alex happy
      RUN apt-get install --yes git
      
      # We install the application first and then test it, in case any tests need to
      # run the tool.
      CMD git clone $REPO && \
          cd $NAME && \
          git checkout $COMMIT && \
          cd .. && \
          cabal v1-install $NAME/$PAT**/ --enable-tests && \
          cabal v1-install $NAME/$PAT**/ --enable-tests --run-tests -j1

      Command:

      $ docker run -e "REPO=https://github.com/NASA/ogma" -e "NAME=ogma" -e PAT="ogma-" -e "COMMIT=5e4949af53ee9286fb6ac8d1c47342e077b19075" -it ogma-test
    • The solution proposed fixes the issues described. Details:
      Executing the script indicated in Address all hlint suggestions #51 :

      $ (for i in ogma-*; do cd $i; hlint --no-summary src/ ; cd ..; done | [ $(wc -c) -eq 0 ]) && echo Success

      prints the word Success.

  • Implementation is documented. Details:
    No changes to the documentation needed (changes in config files or not affecting the API).
  • Change history is clear.
  • Commit messages are clear.
  • Changelogs are updated.
  • Examples are updated. Details:
    No examples affected.
  • Required version bumps are evaluated. Details:
    No bump needed.

@ivanperez-keera
Copy link
Member Author

Change Manager: Implementation ready to be merged.

@ivanperez-keera ivanperez-keera added CR:Status:Closed Admin only: Change request that has been completed and removed CR:Status:Implementation Admin only: Change request that is currently being implemented labels Sep 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CR:Status:Closed Admin only: Change request that has been completed CR:Type:Management Admin only: Change request for conformance with policies or procedures
Projects
None yet
Development

No branches or pull requests

1 participant