Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement better filename approach #927

Open
willclarktech opened this issue Apr 18, 2019 · 0 comments
Open

Implement better filename approach #927

willclarktech opened this issue Apr 18, 2019 · 0 comments

Comments

@willclarktech
Copy link
Contributor

Our current filename approach is pretty inconsistent. Eg:

Lowercase with no separation:

$ tree packages/iov-core/src
packages/iov-core/src
├── index.ts
├── integrationtests
│   ├── atomicswapbnsbcp.spec.ts
│   └── atomicswapbnseth.spec.ts
├── jsrpc.spec.ts
├── jsrpc.ts
├── jsrpcsigningserver.spec.ts
├── jsrpcsigningserver.ts
├── multichainsigner.spec.ts
├── multichainsigner.ts
├── signingservercore.spec.ts
├── signingservercore.ts
├── signingservice.spec.ts
└── workers
    └── signingservice.worker.ts

Lowercase separated by underscores

$ tree scripts/bnsd
scripts/bnsd
├── README.md
├── bnsd_app.sh
├── bnsd_init.sh
├── bnsd_tm.sh
├── genesis_app_state.json
├── start.sh
└── stop.sh

CamelCase:

$ tree scripts/ethereum/deployment/src
scripts/ethereum/deployment/src
├── AshToken.ts
├── AshTokenAbi.ts
├── AtomicSwapErc20.ts
├── AtomicSwapErc20Abi.ts
├── AtomicSwapEther.ts
├── AtomicSwapEtherAbi.ts
├── TrashToken.ts
├── TrashTokenAbi.ts
└── deploy_contracts.ts

Long names without any kind of separation between words is ugly and difficult to read. Mixed-case filenames can cause lots of trouble because they might be handled differently by different OSes (sorting etc) and the default git setting is to ignore case. I therefore propose renaming all files to meet the following standard:

  1. Only lowercase letters. (I could also support making an exception for .md files, where it's traditional to use all-caps in some situations.)
  2. Underscore separation between words. (I could also support hyphen separation, but we already use underscore separation fairly widely.)
  3. Dot-separation at the end of the name before the file type should be used for a defined set of file sub-types (eg we currently use .spec.ts, .worker.ts etc).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant