Skip to content

Commit 9cc9a91

Browse files
committed
[ lint ] Add linter to the CI
1 parent 71e1f14 commit 9cc9a91

File tree

8 files changed

+66
-21
lines changed

8 files changed

+66
-21
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
name: Lint
3+
4+
on:
5+
push:
6+
branches:
7+
- '**'
8+
tags:
9+
- '**'
10+
pull_request:
11+
branches:
12+
- main
13+
- master
14+
# Allows you to run this workflow manually from the Actions tab
15+
workflow_dispatch:
16+
17+
permissions:
18+
statuses: write
19+
20+
concurrency:
21+
group: ${{ github.workflow }}@${{ github.ref }}
22+
cancel-in-progress: true
23+
24+
jobs:
25+
build:
26+
name: Lint Code Base
27+
# Disable PR from the same repo
28+
if: github.event_name != 'pull_request' ||
29+
github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
30+
runs-on: ubuntu-latest
31+
steps:
32+
33+
- name: Checkout
34+
uses: actions/checkout@v4
35+
with:
36+
# Full git history is needed to get a proper
37+
# list of changed files within `super-linter`
38+
fetch-depth: 0
39+
40+
- name: Lint Code Base
41+
uses: super-linter/super-linter/slim@v8
42+
env:
43+
DEFAULT_BRANCH: master
44+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45+
IGNORE_GENERATED_FILES: true

src/Test/Common/UniqueFins.idr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import Test.DepTyCheck.Gen
66
import public Test.Common.Utils
77

88
public export
9-
data UniqueFins : (n : Nat) -> (fs : FinsList n) -> Type where
9+
data UniqueFins : (n : Nat) -> (fs : FinsList n) -> Type where
1010
Nil : UniqueFins n []
1111
(::) : (f : Fin n) -> FinNotIn rest f => UniqueFins n rest -> UniqueFins n (f::rest)
1212

src/Test/Common/Utils.idr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ namespace FinsList
3131
data FinNotIn : FinsList srcs -> Fin srcs -> Type where
3232
FNIEmpty : FinNotIn [] f
3333
FNICons : {x, f : Fin srcs} -> (0 _ : So $ x /= f) -> (fni: FinNotIn xs f) -> FinNotIn (x :: xs) f
34-
34+
3535
-- public export
3636
-- data FinInFL : FinsList l -> Fin l -> Type where
3737
-- Here : (n, n' : Fin l) => (0 _ : So $ n == n') => FinInFL (n::ns) n'

src/Test/Verilog/Connections.idr

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ isMD (Net Wor' t) = True
211211
isMD _ = False
212212

213213
||| 10.3.2 The continuous assignment statement
214-
||| Variables can only be driven by one continuous assignment or by one primitive output or module output.
214+
||| Variables can only be driven by one continuous assignment or by one primitive output or module output.
215215
||| IEEE 1800-2023
216216
public export
217217
data SingleDriven : SVObject -> Type where
@@ -220,7 +220,7 @@ data SingleDriven : SVObject -> Type where
220220

221221
public export
222222
isSD : SVObject -> Bool
223-
isSD (Var st) = True
223+
isSD (Var st) = True
224224
isSD (Net Uwire' st) = True
225225
isSD _ = False
226226

@@ -336,10 +336,10 @@ ultraSuperReplace SSC = superReplaceSC
336336

337337
public export
338338
typeOfPort : (ms : ModuleSigsList) -> (m : ModuleSig) -> (subMs : FinsList ms.length) -> FillMode ms m subMs n -> Fin n -> SVObject
339-
typeOfPort ms m subMs TSK = typeOf (topSnks m)
339+
typeOfPort ms m subMs TSK = typeOf (topSnks m)
340340
typeOfPort ms m subMs SSK = typeOf (subSnks ms m subMs)
341-
typeOfPort ms m subMs TSC = typeOf (topSrcs m)
342-
typeOfPort ms m subMs SSC = typeOf (subSrcs ms m subMs)
341+
typeOfPort ms m subMs TSC = typeOf (topSrcs m)
342+
typeOfPort ms m subMs SSC = typeOf (subSrcs ms m subMs)
343343

344344
public export
345345
noSource : MultiConnection ms m subMs -> Bool
@@ -362,7 +362,7 @@ data FitAny : {ms : ModuleSigsList} -> {m : ModuleSig} -> {subMs : FinsList ms.l
362362
ExistingAny : (f : Fin $ length rest) ->
363363
(cap : CanAddPort {ms} {m} {subMs} mode $ index rest f) ->
364364
(jmc : JustMC (ultraSuperReplace {ms} {m} {subMs} mode i $ index rest f) newMC) ->
365-
(cc : CanConnect (valueOf $ typeOf $ index rest f) (valueOf $ typeOfPort ms m subMs mode i)) ->
365+
(cc : CanConnect (valueOf $ typeOf $ index rest f) (valueOf $ typeOfPort ms m subMs mode i)) ->
366366
FitAny {ms} {m} {subMs} rest i mode $ replaceAt rest f newMC
367367

368368
public export
@@ -382,7 +382,7 @@ data FillAny : {ms : ModuleSigsList} -> {m : ModuleSig} -> {subMs : FinsList ms.
382382
(pre : MultiConnectionsList ms m subMs) -> {n : _} -> (i : Nat) ->
383383
FillMode ms m subMs n -> (aft : MultiConnectionsList ms m subMs) -> Type where
384384
FANil : FillAny pre Z mode pre
385-
FACons : {jf : JustFin (natToFin' i n) f} -> (fit : FitAny {ms} {m} {subMs} {n} mid f mode aft) ->
385+
FACons : {jf : JustFin (natToFin' i n) f} -> (fit : FitAny {ms} {m} {subMs} {n} mid f mode aft) ->
386386
(rest : FillAny {ms} {m} {subMs} pre {n} i mode mid) ->
387387
FillAny {ms} {m} {subMs} pre {n} (S i) mode aft
388388

@@ -418,7 +418,7 @@ genJF : Fuel -> {n : _} -> (mf : MFin n) -> Gen MaybeEmpty (f : Fin n ** JustFin
418418

419419
export
420420
genFillAny : Fuel -> {ms : ModuleSigsList} -> {m : ModuleSig} -> {subMs : FinsList ms.length} ->
421-
(pre : MultiConnectionsList ms m subMs) -> {n : _} -> (i : Nat) -> (mode : FillMode ms m subMs n) ->
421+
(pre : MultiConnectionsList ms m subMs) -> {n : _} -> (i : Nat) -> (mode : FillMode ms m subMs n) ->
422422
Gen MaybeEmpty (aft : MultiConnectionsList ms m subMs ** FillAny {ms} {m} {subMs} {n} pre i mode aft)
423423
genFillAny x pre Z mode = pure (pre ** FANil)
424424
genFillAny x pre (S i) mode = do
@@ -430,6 +430,6 @@ genFillAny x pre (S i) mode = do
430430
export
431431
genModules : Fuel -> (ms : ModuleSigsList) ->
432432
(Fuel -> {ms' : ModuleSigsList} -> {m' : ModuleSig} -> {subMs' : FinsList ms'.length} ->
433-
(pre' : MultiConnectionsList ms' m' subMs') -> {n' : _} -> (i' : Nat) -> (mode' : FillMode ms' m' subMs' n') ->
433+
(pre' : MultiConnectionsList ms' m' subMs') -> {n' : _} -> (i' : Nat) -> (mode' : FillMode ms' m' subMs' n') ->
434434
Gen MaybeEmpty (aft' : MultiConnectionsList ms' m' subMs' ** FillAny {ms=ms'} {m=m'} {subMs=subMs'} {n=n'} pre' i' mode' aft')) =>
435435
Gen MaybeEmpty $ Modules ms

src/Test/Verilog/Literal.idr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ namespace BinaryList
3030
namespace TypeLiteralVect
3131

3232
public export
33-
data TypeLiteral : SVType -> Type
33+
data TypeLiteral : SVType -> Type
3434

3535
public export
3636
data TypeLiteralVect : Nat -> SVType-> Type where
3737
Nil : TypeLiteralVect 0 t
3838
(::) : TypeLiteral t -> TypeLiteralVect n t -> TypeLiteralVect (S n) t
39-
39+
4040
export
4141
toList : TypeLiteralVect l t -> List $ TypeLiteral t
4242
toList [] = []

src/Test/Verilog/Pretty.idr

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ showSVType ua@(UnpackedArr t s e) name = "\{showPackedSVT $ basic t} \{name}
160160
basic : SVType -> SVType
161161
basic (UnpackedArr t _ _) = basic t
162162
basic t = t
163-
163+
164164
unpDimensions : SVType -> String
165165
unpDimensions (UnpackedArr t s e) = "[\{show s}:\{show e}]" ++ unpDimensions t
166166
unpDimensions _ = ""
@@ -264,7 +264,7 @@ iMcsByF mcs func fin = findIndex resolve $ toVect mcs where
264264
resolve : MultiConnection ms m subMs -> Bool
265265
resolve sc = isElem fin $ func sc
266266

267-
findMcsNameByF : (extractField : MultiConnection ms m subMs -> List $ Fin iport) ->
267+
findMcsNameByF : (extractField : MultiConnection ms m subMs -> List $ Fin iport) ->
268268
(mcs : MultiConnectionsList ms m subMs) -> Vect (length mcs) String -> Fin iport -> String
269269
findMcsNameByF extract mcs mcsNames fin = case iMcsByF mcs extract fin of
270270
Just mcsFin => index mcsFin mcsNames
@@ -319,8 +319,8 @@ parameters {opts : LayoutOpts} (m : ModuleSig) (ms: ModuleSigsList) (subMs : Fi
319319
(ctxInps : List SVObject) -> (ctxOuts : List SVObject) -> (exInps : List String) -> (exOuts : List String) -> List (Doc opts)
320320
printSubm' pre siNames soNames exM ctxInps ctxOuts exInps exOuts = do
321321
let warningsSubOuts = printAllImplicitCasts showSVObj (toList exM.outputs) exOuts ctxOuts soNames
322-
let warningsSubInps = printAllImplicitCasts showSVObj ctxInps siNames (toList exM.inputs) exInps
323-
let warnings = if isNil warningsSubOuts ||
322+
let warningsSubInps = printAllImplicitCasts showSVObj ctxInps siNames (toList exM.inputs) exInps
323+
let warnings = if isNil warningsSubOuts ||
324324
isNil warningsSubInps then warningsSubOuts ++ warningsSubInps else warningsSubOuts ++ [ "//" ] ++ warningsSubInps
325325
case isNil warnings of
326326
True => [ pre, line "" ]
@@ -388,8 +388,8 @@ resolveOutputNames mcs mcsNames = map (findTOName mcs mcsNames) $ allFins (m.out
388388
||| Net types aren't compatible with unpacked arrays. So connections to unpacked array ports must be declared explicitly.
389389
unpackedDecls : (mcs : MultiConnectionsList ms m subMs) -> Vect (length mcs) String -> List String
390390
unpackedDecls [] _ = []
391-
unpackedDecls (mc@(MkMC Nothing ssk Nothing ssc) :: mcs) (name::names) = if (isUnpacked $ typeOf mc)
392-
then (showSVObj (typeOf mc) name) :: unpackedDecls mcs names
391+
unpackedDecls (mc@(MkMC Nothing ssk Nothing ssc) :: mcs) (name::names) = if (isUnpacked $ typeOf mc)
392+
then (showSVObj (typeOf mc) name) :: unpackedDecls mcs names
393393
else unpackedDecls mcs names
394394
unpackedDecls (mc :: mcs) (name::names) = unpackedDecls mcs names
395395

src/Test/Verilog/TMPExpression.idr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ data TMPExList : (mcs : MultiConnectionsList ms m subMs) -> FinsList (length mcs
2020
(::) : TMPExpression mcs (valueOf $ typeOf $ index mcs f) -> TMPExList mcs fs -> TMPExList mcs (f::fs)
2121

2222
export
23-
genTMPExList : Fuel -> {ms : _} -> {m : _} -> {subMs : _} ->
23+
genTMPExList : Fuel -> {ms : _} -> {m : _} -> {subMs : _} ->
2424
(mcs : MultiConnectionsList ms m subMs) -> (fs : FinsList $ length mcs) -> Gen MaybeEmpty $ TMPExList mcs fs

src/Test/Verilog/Warnings.idr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import Test.Verilog.SVType
88
-- |||
99
-- ||| module a(output logic [1:0] a1);
1010
-- ||| endmodule: a
11-
-- |||
11+
-- |||
1212
-- ||| module b(input bit b1);
1313
-- ||| endmodule: b
1414
-- |||

0 commit comments

Comments
 (0)