The following code is not accepted by pandoc:
1. Code Behaviors
1. Logging
1. No "bare" `System.out.println`'s
1. Logging level can be calibrated by simple change(s) to logging.xml and/or log4j.properties
1. Errors and exceptions go to appropriate WARN and/or ERROR logging levels
1. Errors and Exceptions
1. Almost never "swallowed"
1. Can only happen for well understood situations
1. Must be documented clearly in code why they are swallowed
1. Only a specific exception or error may be swallowed this way
- In particular can not be done for general Exception.
- Throwable can never be handled this way
Which should look like this:
Code Behaviors
Logging
No "bare" System.out.println's
Logging level can be calibrated by simple change(s) to logging.xml and/or log4j.properties
Errors and exceptions go to appropriate WARN and/or ERROR logging levels
Errors and Exceptions
Almost never "swallowed"
Can only happen for well understood situations
Must be documented clearly in code why they are swallowed
Only a specific exception or error may be swallowed this way
In particular can not be done for general Exception.
Throwable can never be handled this way
Using the command line
pandoc --toc --toc-depth=6 -V fontsize=10pt --pdf-engine xelatex
-V geometry:"left=1.5cm,right=1.5cm,top=2cm,bottom=2cm" -o review.pdf review.md
We get
Error producing PDF.
! LaTeX Error: Too deeply nested.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.159 \begin{enumerate}
Update I tried to add in additional levels using enumitem package to the preamble as suggested here https://tex.stackexchange.com/a/464459/45938 - but to no effect (same error produced):
---
title: My Review
subtitle: My subtitle
documentclass: extarticle
author: First Last Sept 15, 2019
geometry: "left=1.5cm,right=1.5cm,top=2cm,bottom=2cm"
header-includes:
- \usepackage{unicode-math}
- \setmainfont{TeX Gyre Schola}
- \setmathfont{TeX Gyre Schola Math}
- \usepackage{enumitem}
- \setlistdepth{20}
- \renewlist{itemize}{itemize}{20}
- \setlist[itemize]{label=$\cdot$}
- \setlist[itemize,1]{label=\textbullet}
- \setlist[itemize,2]{label=--}
- \setlist[itemize,3]{label=*}
output:
rmarkdown::html_document:
theme: lumen
fig_caption: yes
---
Using enumitem is the correct approach. However, you have to extend both enumerate and itemize environments:
---
header-includes:
- \usepackage{enumitem}
- \setlistdepth{20}
- \renewlist{itemize}{itemize}{20}
- \renewlist{enumerate}{enumerate}{20}
- \setlist[itemize]{label=$\cdot$}
- \setlist[itemize,1]{label=\textbullet}
- \setlist[itemize,2]{label=--}
- \setlist[itemize,3]{label=*}
output:
rmarkdown::pdf_document:
keep_tex: yes
---
1. Code Behaviors
1. Logging
1. No "bare" `System.out.println`'s
1. Logging level can be calibrated by simple change(s) to logging.xml and/or log4j.properties
1. Errors and exceptions go to appropriate WARN and/or ERROR logging levels
1. Errors and Exceptions
1. Almost never "swallowed"
1. Can only happen for well understood situations
1. Must be documented clearly in code why they are swallowed
1. Only a specific exception or error may be swallowed this way
- In particular can not be done for general Exception.
- Throwable can never be handled this way
Output:
Note: The output.rmakrdown::pdf_document.keep_tex flag means that the intermediate tex file is retained.
Related
WARN [runner/nolint] Found unknown linters in //nolint directives: godox todo: fix once roles are in place
This warning keeps coming up when I am building my Golang project. What does this mean?
What is the meaning of unknown linters here?
I already have godox enabled in my config file for the linter but this warning doesn't seem to be going away.
found a solution to this.
I was using a nolint:godox on a todo comment and it was formatted as follows.
//nolint:godox TODO: blah blah..
Which will throw out a warning. So we need to separate the comment from the actual nolint statement.
The correct way to do it is as follows:
//nolint:godox //TODO: blah blah..
I have an R Markdown issue, I am trying to write my thesis on it, when I run the code to generate the pdf, the following message is shown:
! LaTeX Error: Command \counterwithout already defined.
Or name \end... illegal, see p.192 of the manual.
Error: Failed to compile THESIS.tex. See THESIS.log for more info.
Execution halted
Any suggestion?
Found your error on TeX exchange, and the solution seems to be to define the following variables:
\let\counterwithout\relax
\let\counterwithin\relax
Before the package chngcntr (if you are using it).
(Credit to the original answer post)
I couldn't find sample code for a clang-tidy command line for fixing the following error:
[archlinux#thinkpad fizzbuzz]$ clang-tidy fizzbuzz2.cpp -checks=cppcoreguidelines-pro-bounds-constant-array-index
5 warnings generated.
fizzbuzz2.cpp:21:18: warning: do not use array subscript when the index is not an integer constant expression; use gsl::at() instead [cppcoreguidelines-pro-bounds-constant-array-index]
std::cout << arr[index] << std::endl;
^
Suppressed 4 warnings (4 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
[archlinux#thinkpad fizzbuzz]$
I just want to find out how I can get clang-tidy to fix this automatically. If not, how should I use gsl::at() to fix this? The clang-tidy documentation says the following:
cppcoreguidelines-pro-bounds-constant-array-index
This check flags all array subscript expressions on static arrays and std::arrays that either do not have a constant integer expression index or are out of bounds (for std::array). For out-of-bounds checking of static arrays, see the -Warray-bounds Clang diagnostic.
This rule is part of the “Bounds safety” profile of the C++ Core Guidelines, see https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Pro-bounds-arrayindex.
Options
GslHeader
The check can generate fixes after this option has been set to the name of the include file that contains gsl::at(), e.g. “gsl/gsl.h”.
IncludeStyle
A string specifying which include-style is used, llvm or google. Default is llvm.
I found the gsl::at() subroutine in <gsl/gsl_util>. How do I tell clang-tidy to use it to fix my warning?
Edit: I looked at the config string and found the solution to this:
On running:
clang-tidy fizzbuzz2.cpp -checks=cppcoreguidelines-pro-bounds-constant-array-index -dump-config
I got some hints towards the solution
clang-tidy fizzbuzz2.cpp -checks=cppcoreguidelines-pro-bounds-constant-array-index -config="{CheckOptions: [{key: cppcoreguidelines-pro-bounds-constant-array-index.GslHeader, value: gsl/gsl_util}]}" -fix
Edit: I looked at the config string and found the solution to this:
On running:
clang-tidy fizzbuzz2.cpp -checks=cppcoreguidelines-pro-bounds-constant-array-index -dump-config
I got some hints towards the solution
clang-tidy fizzbuzz2.cpp -checks=cppcoreguidelines-pro-bounds-constant-array-index -config="{CheckOptions: [{key: cppcoreguidelines-pro-bounds-constant-array-index.GslHeader, value: gsl/gsl_util}]}" -fix
I am trying port to Dart this nice paper-datatable implementation using custom_element_apigen.
Some problems occurred and sought to find solutions according to my understanding (perhaps included more problems!).
However, still an error is thrown and not been able to move on. I need some help about how port to Dart!!! I will briefly describe the steps, errors and solutions that gave and a link to source code of the project test:
1) I following the steps, accord to https://github.com/dart-lang/custom-element-apigen. I had problems on Windows, but I got to resolve after (custom_element_apigen: gives an error importing paper-datatable to Dart)
2) apigen.yaml used with custom_element_apigen does not clear how to configuration.
I used the "trial-and-error" method until no more error occur. It was so:
files_to_generate:
- paper-datatable\paper-datatable.html
- paper-datatable\paper-datatable-column.html
- paper-datatable\paper-datatable-edit-dialog.html
- paper-datatable\paper-datatable-card.html
- paper-datatable\paper-datatable-styles.html
- paper-datatable\datatable-icons.html
files_to_load:
- package:polymer_elements/src/paper-material/paper-material.html
- package:polymer_elements/src/iron-ajax/iron-request.html
- package:polymer_elements/src/iron-ajax/iron-ajax.html
- package:polymer_elements/src/iron-form/iron-form.html
- package:polymer_elements/src/iron-meta/iron-meta.html
- package:polymer_elements/src/iron-icon/iron-icon.html
- package:polymer_elements/src/iron-iconset-svg/iron-iconset-svg.html
- package:polymer_elements/src/paper-ripple/paper-ripple.html
- package:polymer_elements/src/paper-checkbox/paper-checkbox.html
- package:polymer_elements/src/neon-animation/animations/opaque-animation.html
- package:polymer_elements/src/neon-animation/animations/fade-in-animation.html
- package:polymer_elements/src/neon-animation/animations/fade-out-animation.html
- package:polymer_elements/src/paper-tooltip/paper-tooltip.html
- package:polymer_elements/src/iron-resizable-behavior/iron-resizable-behavior.html
- package:polymer_interop/src/js/debug/src/lib/template/templatizer.html
Some paths imports were wrongs on paper-datatable*.(html and dart) files. p.e. : import 'packages\polymer_interop\src\js\debug\src\lib\template\templatizer.dart'; I changed to import 'package:polymer_interop/src/behaviors/templatize.dart';
on paper_datatable_column.dart.
I changed reserved Dart word default to defaultx on get defaultx => jsElement[r'default']; and set defaultx(value) { jsElement[r'default'] = (value is Map || (value is Iterable && value is! JsArray)) ? new JsObject.jsify(value) : value;} instructions on paper_datatable_column.dart and paper_datatable_card.dart;
After the following erros were occuring in several polymer componentes. P.e.: Failed to execute 'registerElement' on 'Document': Registration failed for type 'iron-meta'. A type with that name is already registered.
I changed all paths into paper-datatable*.* files to get official package (pub.dartlang) of the polymer and polymer elements. P.e.: <link rel="import" href="paper_icon_button_nodart.html"> to <link rel="import" href="../../packages/polymer_elements/paper_icon_button_nodart.html">. The register problem does not occur more!
But now, the following problem is occuring and I don't know how to resolve it: On debug console appear the following message: Uncaught SyntaxError: Unexpected token =>. The web app works on browser, but the paper-datatable does not appear.
My complete test project (webstorm) is on https://github.com/supermuka/paper_datatable_port_dart_demo
Is there some wrong in how I used Dart custom_element_apigen (and apigen.yaml)? Did I some things wrong on paths changed? I also need to change some other source?
Thanks!
Most likely you just created a syntax error when editing the files. That being said there are options built in to do most of the things you manually did, and that also makes it easier to update in the future.
omit_imports: This is used on individual items in the files_to_generate section. It can be used to get rid of the templatizer import entirely, resolving issue #3. See example here.
name_substitutions: This is used on individual items in the files_to_generate section, and allows you to rename fields. You can use this to resolve issue #4, example here.
stubs_to_generate: This option allows you to generate stubs which actually import elements from a different package, this should resolve issue #5 you listed above. See example usage here.
Hopefully that helps, and applying those options will just resolve your issues.
I use Cppcheck 1.70 for checking C++-Builder projects. I get a lot of style warnings like this
[source\DbgRecMain.cpp:452]: (style) The function 'FormResize' is never used.
These functions are event handlers that are used, but not explicitly from within the C++ code: they are bound by the VCL runtime after loading the corresponding form or data module. Naturally, Cppcheck does not check the DFM files, that's why it cannot detect the references between events and handlers defined there.
Some options that come to my mind
Adding some explicit references, but this have to be maintained by hand.
Suppressing all warnings of this kind, but this would hide really dead code.
How can I specifically suppress these warnings about apparently unused event handlers?
There is a chapter in the CppCheck documentation about suppressing warnings/errors. Chapter 6.2 in particular will be useful to you, as you will be able to suppress warnings about the individual event handlers as needed:
Chapter 6. Suppressions
If you want to filter out certain errors you can suppress these.
6.1. Suppressing a certain error type
You can suppress certain types of errors. The format for such a suppression is one of:
[error id]:[filename]:[line]
[error id]:[filename2]
[error id]
The error id is the id that you want to suppress. The easiest way to get it is to use the --xml command line flag. Copy and paste the id string from the XML output. This may be * to suppress all warnings (for a specified file or files).
The filename may include the wildcard characters * or ?, which match any sequence of characters or any single character respectively. It is recommended that you use "/" as path separator on all operating systems.
6.1.1. Command line suppression
The --suppress= command line option is used to specify suppressions on the command line. Example:
cppcheck --suppress=memleak:src/file1.cpp src/
6.1.2. Listing suppressions in a file
You can create a suppressions file. Example:
// suppress memleak and exceptNew errors in the file src/file1.cpp
memleak:src/file1.cpp
exceptNew:src/file1.cpp
// suppress all uninitvar errors in all files
uninitvar
Note that you may add empty lines and comments in the suppressions file.
You can use the suppressions file like this:
cppcheck --suppressions-list=suppressions.txt src/
6.2. Inline suppressions
Suppressions can also be added directly in the code by adding comments that contain special keywords. Before adding such comments, consider that the code readability is sacrificed a little.
This code will normally generate an error message:
void f() {
char arr[5];
arr[10] = 0;
}
The output is:
# cppcheck test.c
Checking test.c...
[test.c:3]: (error) Array ’arr[5]’ index 10 out of bounds
To suppress the error message, a comment can be added:
void f() {
char arr[5];
// cppcheck-suppress arrayIndexOutOfBounds
arr[10] = 0;
}
Now the --inline-suppr flag can be used to suppress the warning. No error is reported when invoking cppcheck this way:
cppcheck --inline-suppr test.c
Also see the following questions for more details:
How to use cppcheck's inline suppression filter option for C++ code?
Can I include cppcheck suppression within a function header?