https://github.com/JohnPostlethwait/fixme
Scan for NOTE, OPTIMIZE, TODO, HACK, XXX, FIXME, and BUG comments within your source, and print them to stdout so you can deal with them.
https://github.com/JohnPostlethwait/fixme
Last synced: 3 months ago
JSON representation
Scan for NOTE, OPTIMIZE, TODO, HACK, XXX, FIXME, and BUG comments within your source, and print them to stdout so you can deal with them.
- Host: GitHub
- URL: https://github.com/JohnPostlethwait/fixme
- Owner: JohnPostlethwait
- License: mit
- Created: 2014-11-18T07:30:19.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2024-06-19T06:20:41.000Z (8 months ago)
- Last Synced: 2024-11-07T09:06:12.334Z (4 months ago)
- Language: JavaScript
- Homepage: http://johnpostlethwait.github.io/fixme
- Size: 63.5 KB
- Stars: 202
- Watchers: 7
- Forks: 20
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-github-star - fixme
README
# Fixme
_**NOTE:** I no longer actively maintain this package. I'd love to get PRs to keep it going though!_

Scan for NOTE, OPTIMIZE, TODO, HACK, XXX, FIXME, and BUG comments within your source, and print them to stdout so you can deal with them. This is similar to the `rake notes` task from Rails.
It ends up giving you an output like this:

The color formatting is currently done using the excellent terminal coloring library [chalk](https://www.npmjs.org/package/chalk).
_Fixme currently scans your matching files line-by-line looking for annotations in the code. As such; multi-line annotation capturing is currently not supported. All annotations must be on the same line._
## Supported Filetypes
Fixme supports scanning for annotations in a variety of file types. The default file patterns it looks for are:
- **JavaScript**: `**/*.js`
- **Makefile**: `Makefile`
- **Shell scripts**: `**/*.sh`
- **HTML**: `**/*.html`
- **CSS**: `**/*.css`
- **JSON**: `**/*.json`
- **Markdown**: `**/*.md`
- **Text files**: `**/*.txt`
- **YAML**: `**/*.yaml`, `**/*.yml`
- **SASS**: `**/*.scss`
- **LESS**: `**/*.less`
- **PHP**: `**/*.php`
- **Java**: `**/*.java`
- **Python**: `**/*.py`
- **Ruby**: `**/*.rb`
- **C++**: `**/*.cpp`
- **C#**: `**/*.cs`
- **Swift**: `**/*.swift`
- **Rust**: `**/*.rs`
- **Go**: `**/*.go`
- **Header files**: `**/*.h`, `**/*.hpp`
- **TypeScript**: `**/*.ts`
- **JSX**: `**/*.jsx`
- **TSX**: `**/*.tsx`
- **Vue.js**: `**/*.vue`
- **Perl**: `**/*.pl`
- **Lua**: `**/*.lua`
- **Groovy**: `**/*.groovy`
- **Scala**: `**/*.scala`
- **Kotlin**: `**/*.kt`
- **Dart**: `**/*.dart`## Usage
In order to use Fixme all you need to do is install it:
> npm install -g fixme
_Note: There really shouldn't be much reason to globally install it..._
Require it:
```javascript
var fixme = require("fixme");
```And finally; configure it when you call it:
```javascript
// All values below are Fixme default values unless otherwise overridden here.
fixme({
path: process.cwd(),
ignored_directories: ["node_modules/**", ".git/**", ".hg/**"],
file_patterns: ["**/*.js", "Makefile", "**/*.sh"],
file_encoding: "utf8",
line_length_limit: 1000,
skip: [],
});
```You should then see some nice output when this is run:
```
• path/to/your/directory/file.js [4 messages]:
[Line 1] ✐ NOTE: This is here because sometimes an intermittent issue appears.
[Line 7] ↻ OPTIMIZE: This could be reworked to not do a O(N2) lookup.
[Line 9] ✓ TODO from John: Add a check here to ensure these are always strings.
[Line 24] ✄ HACK: I am doing something here that is horrible, but it works for now...
[Line 89] ✗ XXX: Let's do this better next time? It's bad.
[Line 136] ☠ FIXME: We sometimes get an undefined index in this array.
[Line 211] ☢ BUG: If the user inputs "Easter" we always output "Egg", even if they wanted a "Bunny".
```### Configure Options (In More Detail)
- **path:** The path to scan through for notes, defaults to process.cwd()
- **ignored_directories:** Glob patterns for directories to ignore. Passes these straight to [minimatch](https://www.npmjs.org/package/minimatch) so check there for more information on proper syntax.
- **file_patterns:** Glob patterns for files to scan. Also uses [minimatch](https://www.npmjs.org/package/minimatch).
- **file_encoding:** The encoding the files scanned will be opened as.
- **line_length_limit:** The number of max characters a line can be before Fixme gives up and doen not scan it for matches. If a line is too long, the regular expression will take an extremely long time to finish. _You have been warned!_
- **skip:** List of check names to skip. Valid options: `note`, `optimize`, `todo`, `hack`, `xxx`, `fixme`, `bug`, `line`. `line` will disable the line length warning.### CLI Usage
```sh
fixme --help
```### Using With [GulpJS](http://gulpjs.com/)
Using this as a GulpJS task is pretty simple, here is a very straight-forward "notes" task:
```javascript
gulp.task("notes", fixme);
```That, of course, assumes all of the defaults in Fixme are ok with you. If not, this is still pretty simple to configure and run as a Gulp task:
```javascript
gulp.task("notes", function () {
fixme({
path: process.cwd(),
ignored_directories: ["node_modules/**", ".git/**", ".hg/**"],
file_patterns: ["**/*.js", "Makefile", "**/*.sh"],
file_encoding: "utf8",
line_length_limit: 1000,
});
});
```### Writing Comments for Use With Fixme
A code annotation needs to follow these rules to be picked up by Fixme:
- Can be preceeded by 0 to n number of characters, this includes the comment characters //, /\*,