`copilot-core`: Compliance with style guide (partial) (3)
ivanperez-keera opened this issue · 6 comments
Description
To comply with our NASA Class D requirements, our code must abide by a style guide.
This is the third issue pertaining to style changes for conformance with Class D within copilot-core
. We focus only on copilot-core
to limit the size of the issue.
Type
- Management: conformance with new requirement.
Additional context
Requester
- Ivan Perez
Method to check presence of bug
Not applicable (not a bug).
Expected result
All Copilot code conforms to the following rules:
- Variable and function names should be lowerCamelCase.
Desired result
All code complies with the rules above.
Proposed solution
Deprecate Copilot.Core.Type.typename
, Copilot.Core.Type.tylength
, Copilot.Core.Type.tysize
, Copilot.Core.Type.fieldname
, Copilot.Core.Type.accessorname
, Copilot.Core.Type.Array.arrayelems
, and define corresponding functions with lowerCamelCase names.
Update all uses across all of copilot to match the new function names.
Further notes
These changes are public facing, they affect functions that are part of the API. We need to follow the deprecation policy for them.
Change Manager: Confirmed that the style is non-conforming and further changes are needed.
Technical Lead: Confirmed that the issue should be addressed.
Technical Lead: Scheduled for fixing in Copilot 3.17.
Fix assigned to: @ivanperez-keera.
Implementor: Solution implemented, review requested.
Change Manager: Verified that:
- Solution is implemented:
-
The code proposed compiles and passes all tests. Details:
Build log: https://app.travis-ci.com/github/Copilot-Language/copilot/builds/267062612 -
The solution proposed produces the expected result. Details:
The following Dockerfile checks that each of the functions in question have been deprecated, in which case it prints the messageSuccess
:
Command (substitute variables based on new path after merge):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 SHELL ["/bin/bash", "-c"] CMD git clone $REPO && cd $NAME && git checkout $COMMIT && cd .. \ && cabal v1-install copilot/copilot-core/ \ && ! cabal v1-exec -- runhaskell -Wall -Werror=deprecations <<< "import Copilot.Core.Type(typename,Struct); t :: Struct a => a -> String ; t = typename; main :: IO (); main = return ()" \ && ! cabal v1-exec -- runhaskell -Wall -Werror=deprecations <<< "{-# LANGUAGE DataKinds #-}; import Copilot.Core.Type(tylength, Type); import Copilot.Core.Type.Array(Array); t :: Type (Array 3 Bool) -> Int ; t = tylength; main :: IO (); main = return ()" \ && ! cabal v1-exec -- runhaskell -Wall -Werror=deprecations <<< "{-# LANGUAGE DataKinds #-}; import Copilot.Core.Type(tysize, Type); import Copilot.Core.Type.Array(Array); t :: Type (Array 3 Bool) -> Int ; t = tysize; main :: IO (); main = return ()" \ && ! cabal v1-exec -- runhaskell -Wall -Werror=deprecations <<< "import GHC.TypeLits(KnownSymbol); import Copilot.Core.Type(fieldname, Field); t :: KnownSymbol s0 => Field s0 t0 -> String; t = fieldname; main :: IO (); main = return ()" \ && ! cabal v1-exec -- runhaskell -Wall -Werror=deprecations <<< "import GHC.TypeLits(KnownSymbol); import Copilot.Core.Type(Field, Struct, accessorname); t :: (Struct a0, KnownSymbol s0) => (a0 -> Copilot.Core.Type.Field s0 t0) -> String; t = accessorname; main :: IO (); main = return ()" \ && ! cabal v1-exec -- runhaskell -Wall -Werror=deprecations <<< "import Copilot.Core.Type.Array(arrayelems); t = arrayelems; main :: IO (); main = return ()" \ && echo "Success"
$ docker run -e "REPO=https://github.com/ivanperez-keera/copilot" -e "NAME=copilot" -e "COMMIT=73aee20036c760b698679f5a32f3b0ac23e17545" -it copilot-verify-457
-
- Implementation is documented. Details:
All new substitute functions include documentation. - Change history is clear.
- Commit messages are clear.
- Changelogs are updated.
- Examples are updated. Details:
No updates needed. - Required version bumps are evaluated. Details:
Bump needed (public definitions are deprecated).
Change Manager: Implementation ready to be merged.