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

Incorrect output with pre-commit hook in gh action #558

Open
Rdeisenroth opened this issue Aug 21, 2024 · 1 comment
Open

Incorrect output with pre-commit hook in gh action #558

Rdeisenroth opened this issue Aug 21, 2024 · 1 comment
Labels
Help-wanted I'd like assistance with this issue, please! pre-commit pre-commit tool; documented at https://latexindentpl.readthedocs.io/en/latest/sec-appendices.html

Comments

@Rdeisenroth
Copy link

situation

Sorry to ask for your time, but i can't think of any way to debug this. Locally (even with act), the the pre-commit hook passes, but the GitHub action always fails and wants to change small things. I will follow the template and provide the settings, but if you need more information, here is the full PR: fdamken/summaries#17 the issue is with the check.yml action (log should be publicly viewable for at least two weeks).

original .tex code

\section{Fisher Discriminant Analysis}
	\subsection{Least Squares Classification}
		\begin{align}
			\hat{\vec{x}}_i       & \coloneqq \begin{bmatrix} \vec{x}_i & 1 \end{bmatrix}^T                                                                                  \\
			\hat{\vec{w}}         & \coloneqq \begin{bmatrix} \vec{w} & w_0 \end{bmatrix}^T                                                                                  \\
			\hat{X}               & \coloneqq \begin{bmatrix} \hat{\vec{x}}_1 & \cdots & \hat{\vec{x}}_n \end{bmatrix} \in \R^{d \times n} \\
			\vec{y}               & \coloneqq \begin{bmatrix} y_1 & \cdots & y_n \end{bmatrix}^T                                                                             \\
			\implies\quad \vec{y} & = \hat{X}^T\hat{\vec{w}}
		\end{align}
	% end
% end

yaml settings

fileExtensionPreference:
  .tex: 1
  .sty: 2
  .cls: 3
  .bib: 4
  .def: 5

verbatimEnvironments:
  codeBlock: 1

verbatimCommands:
  inlinejava: 1
  inlineracket: 1

# indent preamble
indentPreamble: 1

# default value of indentation
defaultIndent: "\t"

# remove trailing whitespace from all lines
removeTrailingWhitespace:
  beforeProcessing: 0
  afterProcessing: 1

# name of code blocks that should have their body aligned at ampersand delimiters
lookForAlignDelims:
  tabular:
    delims: 1
    alignDoubleBackSlash: 1
    spacesBeforeDoubleBackSlash: 1
    multiColumnGrouping: 1
    alignRowsWithoutMaxDelims: 1
    spacesBeforeAmpersand: 1
    spacesAfterAmpersand: 1
    justification: left
    alignFinalDoubleBackSlash: 1
    dontMeasure: 1
    delimiterRegEx: '(?<!\\)(&)'
    delimiterJustification: left
    lookForChildCodeBlocks: 1
  tabularx:
    delims: 1
    alignDoubleBackSlash: 1
    spacesBeforeDoubleBackSlash: 1
    multiColumnGrouping: 1
    alignRowsWithoutMaxDelims: 1
    spacesBeforeAmpersand: 1
    spacesAfterAmpersand: 1
    justification: left
    alignFinalDoubleBackSlash: 1
    dontMeasure: 1
    delimiterRegEx: '(?<!\\)(&)'
    delimiterJustification: left
    lookForChildCodeBlocks: 1

specialBeginEnd:
  customSection:
    begin: \\(?:part|chapter|section|subsection|subsubsection|paragraph|subparagraph)
    end: \%\h+end
  specialBeforeCommand: 1

noAdditionalIndent:
  myexample: 0
  mydefinition: 0
  problem: 0
  exercises: 0
  mysolution: 0
  foreach: 0
  widepage: 0
  comment: 0
  document: 0
  frame: 0

indentRules:
  myenvironment: "\t"
  anotherenvironment: "\t"
  chapter: "\t"
  section: "\t"
  item: "\t"
  myitem: "\t"

noAdditionalIndentGlobal:
  environments: 0
  commands: 1
  optionalArguments: 0
  mandatoryArguments: 0
  ifElseFi: 0
  items: 0
  keyEqualsValuesBracesBrackets: 1
  namedGroupingBracesBrackets: 1
  UnNamedGroupingBracesBrackets: 1
  specialBeginEnd: 0
  afterHeading: 0
  filecontents: 0

# change dos line breaks into unix
dos2unixlinebreaks: 1

# you can specify settings on a per-name basis
modifyLineBreaks:
  oneSentencePerLine:
    manipulateSentences: 1
    removeSentenceLineBreaks: 1
    textWrapSentences: 1
  textWrapOptions:
    columns: 130
    huge: overflow # forbid mid-word line breaks
    separator: ""
    perCodeBlockBasis: 0
    beforeFindingChildCodeBlocks: 0
    all: 0
    alignAtAmpersandTakesPriority: 1
    environments:
      quotation: 0
    ifElseFi: 0
    optionalArguments: 0
    mandatoryArguments: 0
    items: 0
    specialBeginEnd: 0
    afterHeading: 0
    preamble: 0
    filecontents: 0
    mainDocument: 0
  removeParagraphLineBreaks:
    all: 0
    beforeTextWrap: 0
    alignAtAmpersandTakesPriority: 1
    environments:
      quotation: 0
    ifElseFi: 0
    optionalArguments: 0
    mandatoryArguments: 0
    items: 0
    specialBeginEnd: 0
    afterHeading: 0
    preamble: 0
    filecontents: 0
    mainDocument: 0
    paragraphsStopAt:
      environments: 1
      verbatim: 1
      commands: 0
      ifElseFi: 0
      items: 0
      specialBeginEnd: 0
      heading: 0
      filecontents: 0
      comments: 0
  environments:
    BeginStartsOnOwnLine: 1
    BodyStartsOnOwnLine: 1
    EndStartsOnOwnLine: 1
    EndFinishesWithLineBreak: 1
    # equation*:
    #     BeginStartsOnOwnLine: 1
    #     BodyStartsOnOwnLine: 1
    #     EndStartsOnOwnLine: 1
    #     EndFinishesWithLineBreak: 1
  ifElseFi:
    IfStartsOnOwnLine: 1
    BodyStartsOnOwnLine: 1
    OrStartsOnOwnLine: 1
    OrFinishesWithLineBreak: 1
    ElseStartsOnOwnLine: 1
    ElseFinishesWithLineBreak: 1
    FiStartsOnOwnLine: 1
    FiFinishesWithLineBreak: 1
    ifnum:
      IfStartsOnOwnLine: 1
      BodyStartsOnOwnLine: 1
      OrStartsOnOwnLine: 1
      OrFinishesWithLineBreak: 1
      ElseStartsOnOwnLine: 1
      ElseFinishesWithLineBreak: 1
      FiStartsOnOwnLine: 1
      FiFinishesWithLineBreak: 1
  items:
    ItemStartsOnOwnLine: 1

# fineTuning allows you to tweak the internal pattern matching that
# is central to latexindent.pl
fineTuning:
  namedGroupingBracesBrackets:
    name: "[0-9\\.a-zA-Z@\\*><~\\=\\-]+?"
    follow: "\\h|\\R|\\{|\\[|\\$|\\)|\\("
  trailingComments:
      notPreceededBy: (?<!\\)
      afterComment: (?!(?:\hend)).*?

actual/given output

\section{Fisher Discriminant Analysis}
	\subsection{Least Squares Classification}
		\begin{align}
			\hat{\vec{x}}_i       & \coloneqq \begin{bmatrix} \vec{x}_i & 1 \end{bmatrix}^T                                                                                            \\
			\hat{\vec{w}}         & \coloneqq \begin{bmatrix} \vec{w} & w_0 \end{bmatrix}^T                                                                                            \\
			\hat{X}               & \coloneqq \begin{bmatrix} \hat{\vec{x}}_1 & \cdots & \hat{\vec{x}}_n \end{bmatrix} \in \R^{d \times n} \\
			\vec{y}               & \coloneqq \begin{bmatrix} y_1 & \cdots & y_n \end{bmatrix}^T                                                                                       \\
			\implies\quad \vec{y} & = \hat{X}^T\hat{\vec{w}}
		\end{align}
	% end
% end

desired or expected output

\section{Fisher Discriminant Analysis}
	\subsection{Least Squares Classification}
		\begin{align}
			\hat{\vec{x}}_i       & \coloneqq \begin{bmatrix} \vec{x}_i & 1 \end{bmatrix}^T                                                                                  \\
			\hat{\vec{w}}         & \coloneqq \begin{bmatrix} \vec{w} & w_0 \end{bmatrix}^T                                                                                  \\
			\hat{X}               & \coloneqq \begin{bmatrix} \hat{\vec{x}}_1 & \cdots & \hat{\vec{x}}_n \end{bmatrix} \in \R^{d \times n} \\
			\vec{y}               & \coloneqq \begin{bmatrix} y_1 & \cdots & y_n \end{bmatrix}^T                                                                             \\
			\implies\quad \vec{y} & = \hat{X}^T\hat{\vec{w}}
		\end{align}
	% end
% end

anything else

Any tips on debugging this would be really helpful

@cmhughes cmhughes added pre-commit pre-commit tool; documented at https://latexindentpl.readthedocs.io/en/latest/sec-appendices.html Help-wanted I'd like assistance with this issue, please! labels Aug 23, 2024
@cmhughes
Copy link
Owner

help wanted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Help-wanted I'd like assistance with this issue, please! pre-commit pre-commit tool; documented at https://latexindentpl.readthedocs.io/en/latest/sec-appendices.html
Projects
None yet
Development

No branches or pull requests

2 participants