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

Fix some Notes so they pass the check #5930

Merged
merged 1 commit into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions plutus-tx-plugin/test/Plugin/NoTrace/Spec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ noTrace = pure do
3 @=? countTraces WithTraces.traceRepeatedly
, testCase "trace-impure" $
1 @=? countTraces WithTraces.traceImpure
, testCase "trace-impure with effect" $ -- See note [Impure trace messages]
, testCase "trace-impure with effect" $ -- See Note [Impure trace messages]
assertBool "Effect is missing" (Lib.evaluatesToError WithTraces.traceImpure)
]
, testGroup
Expand All @@ -55,7 +55,7 @@ noTrace = pure do
0 @=? countTraces WithoutTraces.traceRepeatedly
, testCase "trace-impure" $
0 @=? countTraces WithoutTraces.traceImpure
, testCase "trace-impure without effect" $ -- See note [Impure trace messages]
, testCase "trace-impure without effect" $ -- See Note [Impure trace messages]
assertBool "Effect wasn't erased" (Lib.evaluatesWithoutError WithoutTraces.traceImpure)
]
]
2 changes: 1 addition & 1 deletion plutus-tx/src/PlutusTx/Blueprint/Contract.hs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import PlutusTx.Blueprint.Validator (ValidatorBlueprint)

The 'referencedTypes' type variable is used to track the types used in the contract
making sure their schemas are included in the blueprint and that they are referenced
in a type-safe way. See the note ["Unrolling" types] for more details.
in a type-safe way. See Note ["Unrolling" types] for more details.
-}
data ContractBlueprint where
MkContractBlueprint ::
Expand Down
2 changes: 1 addition & 1 deletion plutus-tx/src/PlutusTx/Blueprint/Definition/Unroll.hs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import PlutusTx.Builtins.Internal (BuiltinByteString, BuiltinData, BuiltinList,
BuiltinUnit)

----------------------------------------------------------------------------------------------------
-- Functionality to "unroll" types. -- For more context see the note ["Unrolling" types] -----------
-- Functionality to "unroll" types. -- For more context see Note ["Unrolling" types] -----------

{- Note ["Unrolling" types]

Expand Down
18 changes: 9 additions & 9 deletions scripts/check-Notes.awk
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 added some extra newlines to make the output more readable.

Original file line number Diff line number Diff line change
Expand Up @@ -120,41 +120,41 @@ maybeSplitReference && /^[- \t-]*\[/ {
# Check for plural references
/(NOTES|Notes|notes) *\[/ {
printf ("Invalid note format (no plurals allowed) at %s:%d\n ", FILENAME, FNR)
printf ("> %s\n", $0)
printf ("> %s\n\n", $0)
exitCode = 1
}

# Check that we have at least one space after "Note"
/Note\[/ {
printf ("Invalid note format (space expected after \"Note\") at %s:%d\n", FILENAME, FNR)
printf ("> %s\n", $0)
printf ("> %s\n\n", $0)
exitCode = 1
}
# Check for invalid characters
/Note *[^ ] *\[/ { # There is a non-space (eg ":") between "Note" and "["
printf ("Invalid note format at %s:%d\n", FILENAME, FNR)
printf ("> %s\n", $0)
printf ("> %s\n\n", $0)
exitCode = 1
}

# Check for Haddock
/(--|{-) *\| *Note *\[/ {
printf ("Invalid note format (no Haddock allowed) at %s:%d ", FILENAME, FNR)
printf ("> %s\n", $0)
printf ("> %s\n\n", $0)
exitCode = 1
}

# Check for improper capitalisation
/(NOTE|note) *\[/ { # We require all references to be of the form `Note [...]`
printf ("Invalid note format (must say \"Note [...]\") at %s:%d\n", FILENAME, FNR)
printf ("> %s\n", $0)
printf ("> %s\n\n", $0)
exitCode = 1
}

# Make sure there's at least one space before "Note" in a definition
/(--|{-)Note *\[/ {
printf ("Invalid note format (space expected before \"Note\") at %s:%d\n", FILENAME, FNR)
printf ("> %s\n", $0)
printf ("> %s\n\n", $0)
exitCode = 1
}

Expand All @@ -164,7 +164,7 @@ maybeSplitReference && /^[- \t-]*\[/ {
if (defined[noteName]) {
if (longOutput) {
printf ("Duplicate Note [%s] at %s:%d and %s", noteName, FILENAME, FNR, defined[noteName])
printf ("> %s\n", $0)
printf ("> %s\n\n", $0)
}
else printf ("Duplicate Note [%s]\n", noteName)
}
Expand Down Expand Up @@ -198,13 +198,13 @@ END { # Report references which refer to missing Notes.
w = max(w,length(x))
for (x in referenced)
if (!(x in defined)) {
printf ("Missing Note %-*s%s\n", w+3, "["x"]", referenced[x])
printf ("Missing Note %-*s%s\n\n", w+3, "["x"]", referenced[x])
exitCode = 1
}
}
else for (x in referenced)
if (!(x in defined)) {
printf ("Missing Note [%s]\n", x)
printf ("Missing Note [%s]\n\n", x)
exitCode = 1
}
exit exitCode
Expand Down
Loading