(Translated by https://www.hiragana.jp/)
GitHub - leomotors/CRLF-Phobia: Scared of CRLF, panics if there is any CRLF exists, can be used with testing to ensure no one is hiding CRLF in their code
Skip to content

Scared of CRLF, panics if there is any CRLF exists, can be used with testing to ensure no one is hiding CRLF in their code

License

Notifications You must be signed in to change notification settings

leomotors/CRLF-Phobia

Repository files navigation

CRLF-Phobia

CRLF can cause disaster on your app sometimes.

Run this simple inefficient app to scan your project files and it will warn you if there is a file with CRLF endings.

This app will ignore files ignored by .gitignore by default if exists, It also ignores binary files. You can add or remove ignore files by using adding .crlfignore to the same level.

Installation:

npm i -g crlf-phobia # Global
npm i -D crlf-phobia # To hook with unit test locally

Usage:

crlf-phobia *.cpp # All CPP
crlf-phobia * .* # All Files exclude gitignored (for zsh, for PowerShell idk)

Note: CRLF-Phobia support both shell glob (Glob done by shell before parsing argv into program) and also shipped with glob in case your shell is lazy.

Q: Isn't there already an npm package that can do this?

A: Yes

Q: So how is yours different?

A: Colors and MEMES

jk, this one is designed with "crlf-phobia" in mind.

駆逐くちくしてやる このプロジェックから、いちひきのこらず」

I will wipe out every single CRLF from this project.

Limitation

  • Awful performance: This library check for whole file to make sure not a single CRLF can survive!

  • Can only detect CRLF, because who use CR nowadays?

Advanced Usage

Run before test:

"test": "crlf-phobia * .* && pnpm real-test"

Run with GitHub Workflow

name: CRLF Phobia

on:
  push:

jobs:
  main:
    name: NO CRLF
    runs-on: ubuntu-latest

    steps:
      - name: actions/checkout
        uses: actions/checkout@v3

      # Do anything you want

      - name: Run CRLF-Phobia
        run: npx crlf-phobia * .*

About

Scared of CRLF, panics if there is any CRLF exists, can be used with testing to ensure no one is hiding CRLF in their code

Resources

License

Stars

Watchers

Forks