Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
push:
branches: [main]
pull_request:
branches: [main]

permissions: {}

Expand Down
32 changes: 32 additions & 0 deletions NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ Adaptations select literal directories and filenames or suffixes, apply them
at any package depth, and assign roles and subtypes. They do not evaluate
ignore patterns or import template negations. Python bytecode suffixes are
limited to .pyc and .pyo. Lockfile names continue to come from manifests.
Vendor, documentation and generated-file conventions: github-linguist/linguist,
revision 16cac170f73c97eb4e4329d66fcb341ef25ef4f0.
Sources: lib/linguist/vendor.yml, documentation.yml and generated.rb.
Adaptations assign roles by repository purpose, narrow broad patterns to
selected names, and apply documentation directories at any package depth.
Document extensions are restricted; lowercase extensionless install/change
commands are excluded. Manifest names, content heuristics and attribute
overrides are not imported. Wrapper scripts receive build evidence; Pods
receives vendor evidence; named minified files receive generated evidence.
Rules identified as roles are local conventions or intentional adaptations.

MIT License
Expand Down Expand Up @@ -54,3 +63,26 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Copyright (c) 2017 GitHub, Inc.

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ independent evidence.
| `test/fixtures/input.json` | `test`, `fixture` |
| `testdata/package-lock.json` | `test`, `fixture`, `generated` |
| `packages/api/uv.lock` | `generated` |
| `src/Form.Designer.cs` | `source`, `generated` |
| `Pods/library/main.swift` | `vendor` |
| `gradlew` | `build` |
| `.gitattributes` | `configuration` |
| `examples/client/main.go` | `example` |
| `docs/api.md` | `documentation` |
| `.github/SECURITY.md` | `documentation` |
Expand Down Expand Up @@ -194,17 +198,28 @@ such as `.pytest_cache/`; generic names such as `.cache/` and `build/`, and
virtual environments, receive no additional role. Bower, JSPM and vcpkg dependency
directories receive `vendor` alongside any roles matched inside them.

Named minified JavaScript/CSS files, source maps and .NET designer files
also receive `generated`. Source-map and designer suffixes accept mixed
case; minified suffixes use lowercase `.min.js`, `-min.js`, `.min.css` and
`-min.css`. A plain `.d.ts` filename or a name such as `jquery.js` does not
establish generated or vendored content.

Named community documents include support, governance, maintainers,
authors and roadmaps, using case-insensitive stems and selected document
extensions, including `.markdown` and `.rdoc`. For example, `SUPPORT.md`,
`support.md` and `Support.md` match, while `support.py` and `SUPPORT.md.bak`
do not. Rakefile matching accepts any casing with an optional `.rb` extension.
Citation files, API/manual directories and installation/change documents
provide further documentation conventions. Bare `INSTALL`, `CHANGE` and
`CHANGES` match; their lowercase command names require a document extension.

Sources include legal-name matching from [licenses](https://github.com/git-pkgs/licenses),
layout and tool conventions from [brief](https://github.com/git-pkgs/brief),
manifest, lockfile and dependency-output names from
[manifests](https://github.com/git-pkgs/manifests), and selected generated-file
and dependency-directory conventions from [GitHub's gitignore templates](https://github.com/github/gitignore).
[GitHub Linguist](https://github.com/github-linguist/linguist) supplies additional
vendor, documentation and generated-file conventions, adapted to these roles.
[NOTICE](NOTICE) records source revisions and attribution. `CorpusVersion`
identifies the embedded classification semantics for caller caches.

Expand Down
1 change: 1 addition & 0 deletions benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ func BenchmarkMatch(b *testing.B) {
"main.go", "LICENSE", "packages/parser/vendor/src/parser_test.go",
"packages/api/src/__pycache__/app.pyc", "packages/ui/project.tsbuildinfo",
"packages/api/.pytest_cache/v/cache/nodeids",
"packages/ui/Form.DESIGNER.CS", "packages/ui/app.min.js",
} {
b.Run(name, func(b *testing.B) {
b.ReportAllocs()
Expand Down
16 changes: 12 additions & 4 deletions corpus.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var (
filenameRules = map[string][]rule{}
foldedStems = map[int][]rule{}
foldedDirectories []rule
pathDirectories []rule
pathDirectories = map[string][]rule{}
foldedPrefixes []rule
suffixRules [256][]rule
)
Expand Down Expand Up @@ -67,14 +67,22 @@ func init() {
case "directory-fold":
foldedDirectories = append(foldedDirectories, r)
case "directory-path":
pathDirectories = append(pathDirectories, r)
base := r.Pattern[strings.LastIndexByte(r.Pattern, '/')+1:]
pathDirectories[base] = append(pathDirectories[base], r)
case "prefix-fold":
foldedPrefixes = append(foldedPrefixes, r)
case "suffix":
last := r.Pattern[len(r.Pattern)-1]
case "suffix", "suffix-fold":
last := suffixBucket(r.Pattern[len(r.Pattern)-1])
suffixRules[last] = append(suffixRules[last], r)
default:
panic(fmt.Sprintf("unknown rule kind %q", r.Kind))
}
}
}

func suffixBucket(last byte) byte {
if last >= 'A' && last <= 'Z' {
return last + ('a' - 'A')
}
return last
}
Loading