Skip to content

Commit 1ba943d

Browse files
committed
Mandatory rules blog post
1 parent a9f4d4f commit 1ba943d

File tree

5 files changed

+44
-29
lines changed

5 files changed

+44
-29
lines changed

docs/_drafts/mandatory-rules.md

Lines changed: 0 additions & 14 deletions
This file was deleted.

docs/_layouts/default.html

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -71,20 +71,21 @@
7171
<div class="row">
7272
<div class="col pt-2">
7373
<div class="pb-2 d-flex align-items-center justify-content-between">
74-
<h1 class="flex-grow-1">
75-
{% if page.h1 %}{{page.h1}}{% else %}{{page.title}}{% endif %}
76-
</h1>
77-
<div class="text-end">
78-
{% if page.previous.url %}
79-
<a class="btn btn-outline-secondary" href="{{page.previous.url}}" title="{{page.previous.title}}">&laquo;<span
80-
class="d-none d-lg-inline"> {{page.previous.title}}</span></a>
81-
{% endif %}
82-
{% if page.next.url %}
83-
<a class="btn btn-outline-secondary" href="{{page.next.url}}" title="{{page.next.title}}"><span
84-
class="d-none d-lg-inline">{{page.next.title}} </span>&raquo;</a>
85-
{% endif %}
86-
</div>
74+
<h1 class="flex-grow-1">
75+
{% if page.h1 %}{{page.h1}}{% else %}{{page.title}}{% endif %}
76+
</h1>
77+
<div class="text-end">
78+
{% if page.previous.url %}
79+
<a class="btn btn-outline-secondary" href="{{page.previous.url}}" title="{{page.previous.title}}">&laquo;<span
80+
class="d-none d-lg-inline"> {{page.previous.title}}</span></a>
81+
{% endif %}
82+
{% if page.next.url %}
83+
<a class="btn btn-outline-secondary" href="{{page.next.url}}" title="{{page.next.title}}"><span
84+
class="d-none d-lg-inline">{{page.next.title}} </span>&raquo;</a>
85+
{% endif %}
86+
</div>
8787
</div>
88+
{% if page.draft %}<div class="alert alert-warning">This post is a draft!</div>{% endif %}
8889
{{content}}
8990
{% if page.url contains "blog/"-%}
9091
<p class="text-center">

docs/_posts/2024-08-17-prior-art.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ operating systems
2525

2626
- [Rich Jenks' filename regex](https://richjenks.com/filename-regex/) - a regex that tests for cross-plaform issues (including safe for URLs)
2727

28-
- [sindresorhus/filename-reserved-regex](https://github.com/sindresorhus/filename-reserved-regex) - NPM library with regexes for reserved characters and MS-DOS reserved names.
28+
- [sindresorhus/filename-reserved-regex](https://github.com/sindresorhus/filename-reserved-regex) - NPM library with regexes for reserved characters and MS-DOS reserved names. Used in [sindresorhus/filenamify](https://github.com/sindresorhus/filenamify) and [sindresorhus/valid-filename](https://github.com/sindresorhus/valid-filename).
2929

3030
- [filesan](https://github.com/BonnyAD9/filesan) - Rust, a library that sanitizes strings so they can safely be used as file names. I.e. if someone gives you a string as a file name, this will make sure it is safe.
3131

@@ -39,6 +39,8 @@ operating systems
3939

4040
- [CrossRename](https://pypi.org/project/CrossRename/) - Python, focused on portability between Linux and Windows ([source](https://github.com/Jemeni11/CrossRename))
4141

42+
- [flytam/filenamify](https://github.com/flytam/filenamify) - Go, focused on creating portable file names
43+
4244
- [spf13/pathologize](https://github.com/spf13/pathologize) - Go, focused on creating portable file names
4345

4446
- [ClaireCJS/fix_unicode_filenames](https://github.com/ClaireCJS/fix_unicode_filenames) - Python, renames files with Unicode and/or troublesome characters

docs/_posts/2025-04-12-wildcard-danger.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ title: Wildcards are dangerous
44

55
We consider wildcards to be very dangerous from a security standpoint. It is too easy to have something strange in a filename that causes a wildcard to not match. This made worse if there are multiple programs that evaluate wildcards: something could match in one and not in the other.
66

7-
We are explicitly choosing not to support wildcards when specifying top-level paths. Ideally, you should specify the current directory (with `.`) and every file and directry should be included.
7+
We are explicitly choosing not to support wildcards when specifying top-level paths. Ideally, you should specify the current directory (with `.`) and every file and directory should be included.
88

99
Additionally, we want to check *every* file. Even hidden and ignored files should obey basic sanity rules. Thus, we have an `not-linted` rule that will flag every file that doesn't get linted.
1010

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
title: "Mandatory Rules"
3+
---
4+
5+
There are a some rules that cannot be disabled. These rules will cause the file to fail linting and additional lints to be skipped.
6+
7+
## UTF-8 and no nulls
8+
9+
These two rules are mandatory:
10+
11+
1. Must be UTF-8
12+
2. Must not have any null (`0`) bytes
13+
14+
Reasoning:
15+
16+
* If it is encoding in something other than UTF-8, we don't to be in the business of converting encodings.
17+
* If it isn't valid UTF-8 on a system that uses UTF-8 encoding, there then something is really wrong.
18+
* If it has a null byte, again, something is really wrong.
19+
20+
## Rust conversions
21+
22+
Rust is pretty explicit about handling potential errors when converting from paths and directory entries. These failures can't be disabled. In theory, the UTF-8 required rule should catch them, but if something slips through, it will still be a lint failure.
23+
24+
## Simultaneous file changes
25+
26+
A variety of problems can occur if you are changing files/directories while namelint is running. Why would you do that?

0 commit comments

Comments
 (0)