Skip to content

Commit

Permalink
Merge branch 'develop-clean-c99'. Close #453.
Browse files Browse the repository at this point in the history
**Description**

In our effort to comply with our NASA Class D requirements, our code must abide
by a style guide. In particular, the C99 library does not conform to our rules,
so it should be amended.

Full compliance is hard to establish, especially for more opinionated rules
pertaining to simplicity. Further issues may need to address style conformance
concerns.

**Type**

- Management: conformance with new requirement.

**Additional context**

None.

**Requester**

- Ivan Perez

**Method to check presence of bug**

Not applicable (not a bug).

**Expected result**

All Copilot code conforms to the following rules:
- All comments are line comments except for compiler options, language pragmas,
  and annotations/warnings/deprecations.
- Contiguous block comments are alphabetized, given one per line, and
  horizontally aligned.
- Never leave a white spaces between a value and a comma.
- Do not include TODOs or FIXMES.
- A where keyword always stands alone on a line (except for
  class/instance/data/module declarations).
- No more than one empty line between definitions.
- No horizontal lines to separate sections in code.
- No trailing spaces.
- All exports should be explicit.
- All imports should be explicit.
- Imports should be grouped, sorted, alphabetized, and aligned.
- The standard indendation is 2 spaces.
- Always leave a space after a comma.
- Do not require unnecessary pragmas.
- Do not add unnecessary imports.
- Do not include redundant brackets, except where the brackets are meant to
  communicate a conceptual unit.
- Do not include redundant `$`.
- Whenever possible, prefer simpler solutions and expressions.
- Use haddock formatting to capture copyright notices.
- Prefer guards to multiple nested if-then-else.
- Variable names should be camelCase.
- Code should compile without warnings.

**Solution implemented**

Make all code comply with the rules above.

**Further notes**

None.
  • Loading branch information
ivanperez-keera committed Sep 8, 2023
2 parents eeed69c + 22cfd55 commit 7c4a509
Show file tree
Hide file tree
Showing 12 changed files with 627 additions and 518 deletions.
3 changes: 3 additions & 0 deletions copilot-c99/CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
2023-09-07
* Clean code. (#453)

2023-07-07
* Version bump (3.16). (#448)
* Introduce testing infrastructure. (#413)
Expand Down
5 changes: 3 additions & 2 deletions copilot-c99/copilot-c99.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,10 @@ library

exposed-modules : Copilot.Compile.C99

other-modules : Copilot.Compile.C99.Translate
other-modules : Copilot.Compile.C99.Expr
, Copilot.Compile.C99.Type
, Copilot.Compile.C99.Error
, Copilot.Compile.C99.Util
, Copilot.Compile.C99.Name
, Copilot.Compile.C99.CodeGen
, Copilot.Compile.C99.External
, Copilot.Compile.C99.Compile
Expand Down
5 changes: 3 additions & 2 deletions copilot-c99/src/Copilot/Compile/C99.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ module Copilot.Compile.C99
, mkDefaultCSettings
) where

import Copilot.Compile.C99.Compile
import Copilot.Compile.C99.Settings
-- Internal imports
import Copilot.Compile.C99.Compile ( compile, compileWith )
import Copilot.Compile.C99.Settings ( CSettings (..), mkDefaultCSettings )
Loading

0 comments on commit 7c4a509

Please sign in to comment.