Skip to content

Add option for ensuring specific line length#53

Merged
jvoigtlaender merged 6 commits intomasterfrom
line-length
May 5, 2026
Merged

Add option for ensuring specific line length#53
jvoigtlaender merged 6 commits intomasterfrom
line-length

Conversation

@patritzenfeld
Copy link
Copy Markdown
Member

closes #16

  • Reject if submission contains any lines with length > maxLineLength option

  • Display all offending lines at once, including their location, content and total length
    Screenshot From 2026-05-05 15-29-45

  • add this as a separate syntax phase for syntaxCutoff (CodeWidth)

  • Do not write any files while grading if syntaxCutoff is set to CodeWidth and disableSemantics is set.

Question: Should the config checker prevent setting syntaxCutoff to CodeWidth if maxLineLength is unset? I wasn't sure about that, since it may still be useful to directly accept any submission without considering its content (similar to not writing files if we only check the line length).

@github-actions

This comment has been minimized.

@patritzenfeld patritzenfeld marked this pull request as ready for review May 5, 2026 13:43
@jvoigtlaender
Copy link
Copy Markdown
Member

To the question: No.

I also think it may be useful to configure „no other syntax checks than code width, and actually we have no restriction on code width“.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds an optional maxLineLength configuration to reject submissions containing overlong lines, integrates that check as a distinct syntax phase (CodeWidth) that can be selected via syntaxCutoff, and introduces an optimization to skip writing any files during grading when only the CodeWidth syntax phase is run and semantics are disabled.

Changes:

  • Added maxLineLength :: Maybe Natural to the solution config and included it in config parsing/defaulting/combination.
  • Introduced a new FeedbackPhase step CodeWidth and a checkLineLength phase that reports all offending lines (number, content, and length).
  • Skipped file-writing in grade when syntaxCutoff == CodeWidth and disableSemantics is set.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/Haskell/Template/Task.hs Adds maxLineLength, new CodeWidth phase, line-length rejection logic, and a conditional “no file writes” grading path.
.github/actions/spelling/expect.txt Whitelists linebreak for the spelling workflow due to new pretty-print usage.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Haskell/Template/Task.hs
Comment thread src/Haskell/Template/Task.hs Outdated
Comment thread src/Haskell/Template/Task.hs
jvoigtlaender and others added 2 commits May 5, 2026 17:50
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@jvoigtlaender jvoigtlaender merged commit 91eeaf5 into master May 5, 2026
21 checks passed
@jvoigtlaender jvoigtlaender deleted the line-length branch May 5, 2026 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

option for limiting code line length

3 participants