ensure_no_debug_code

Ensures the given text is nowhere in the code base

You don't want any debug code to slip into production.
This can be used to check if there is any debug code still in your codebase or if you have things like // TO DO or similar.

ensure_no_debug_code
Supported platforms mac, linux, windows
Author @KrauseFx

5 Examples

ensure_no_debug_code(text: "// TODO")
ensure_no_debug_code(text: "Log.v",
      extension: "java")
ensure_no_debug_code(text: "NSLog",
 path: "./lib",
      extension: "m")
ensure_no_debug_code(text: "(^#define DEBUG|NSLog)",
 path: "./lib",
      extension: "m")
ensure_no_debug_code(text: "<<<<<<",
     extensions: ["m", "swift", "java"])

Parameters

Key Description Default
text The text that must not be in the code base
path The directory containing all the source files .
extension The extension that should be searched for
extensions An array of file extensions that should be searched for
exclude Exclude a certain pattern from the search
exclude_dirs An array of dirs that should not be included in the search

* = default value is dependent on the user's system


Documentation

To show the documentation in your terminal, run

pantograph action ensure_no_debug_code

CLI

It is recommended to add the above action into your Pantfile, however sometimes you might want to run one-offs. To do so, you can run the following command from your terminal

pantograph run ensure_no_debug_code

To pass parameters, make use of the : symbol, for example

pantograph run ensure_no_debug_code parameter1:"value1" parameter2:"value2"

It's important to note that the CLI supports primitive types like integers, floats, booleans, and strings. Arrays can be passed as a comma delimited string (e.g. param:"1,2,3"). Hashes are not currently supported.

It is recommended to add all pantograph actions you use to your Pantfile.


Source code

This action, just like the rest of pantograph, is fully open source, view the source code on GitHub


Back to actions