This document covers an "advanced" API for you to disable the problems can get reported within your code.
We created this because other tools like ESLint have a similar API within comments to correct errors that get reported.
Please let us know if there are any other ways that you might want to disable problems being reported for your code.
For problems that get reported, we want to make sure that we have all the scenarios covered so that users can disable problems.
There are many unique situations, with any language, where line-by-line or by-file customizations are needed.
This API works for IDL Notebooks and PRO code. The main difference is that, for IDL Notebooks, there's no way to turn comments off for the entire notebook. If you think this could be a useful feature, then feel free to make a feature request on GitHub and we can take a look.
While we will properly detect problems being disabled in routine comments and problems will be disabled as you expect, the next time your code is formatted the idl-disable statements will be stripped out of the documentation for the routine.
Please follow our best practices and use comments next to problems or at the very top of your file.
Disabling Problems with Comments
Pro Tip
This document covers an "advanced" API for you to disable the problems can get reported within your code.
We created this because other tools like ESLint have a similar API within comments to correct errors that get reported.
Please let us know if there are any other ways that you might want to disable problems being reported for your code.
For problems that get reported, we want to make sure that we have all the scenarios covered so that users can disable problems.
There are many unique situations, with any language, where line-by-line or by-file customizations are needed.
This API works for IDL Notebooks and PRO code. The main difference is that, for IDL Notebooks, there's no way to turn comments off for the entire notebook. If you think this could be a useful feature, then feel free to make a feature request on GitHub and we can take a look.
Disabling for a File or Notebook Cell
Best Practice
Either create a standalone comment block or comment at the top of your file or notebook cell when disabling problems for an entire file.
To disable reporting any problem for an entire file, add the following to the top of your file (as a standalone comment, or in a comment block).
If you just want to turn off specific problems for a given file, then you specify the problem aliases following
idl-disable
:2
3
4
5
6
7
You can also use a comment block at the top of your file with many problems:
2
3
4
5
6
7
8
9
10
11
And you can mix-and-match between the two:
2
3
4
5
6
7
8
9
10
11
12
13
Disabling for a Line
There are two ways that you an disable a problem code being reported by line.
First, use
idl-disable-line
to disable one or more problem codes for that exact line by adding it after your code.Alternatively, you can disable the problem code by putting
idl-disable-next-line
before it:2
You can add problem disabling to any comment block (they are also stripped from the docs):
2
3
4
5
6
For the example above, the "next" line indicates the line after the comment block ends.
If you don't close your comment block, this also applies to the next line the same way:
2
3
This example isn't the cleanest (or easiest to read), but it works!
Don't Add to Routine Comments
While we will properly detect problems being disabled in routine comments and problems will be disabled as you expect, the next time your code is formatted the
idl-disable
statements will be stripped out of the documentation for the routine.Please follow our best practices and use comments next to problems or at the very top of your file.