lintrunner 0.10.6__tar.gz → 0.10.7__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of lintrunner might be problematic. Click here for more details.

Files changed (61) hide show
  1. {lintrunner-0.10.6 → lintrunner-0.10.7}/.github/workflows/CI.yml +4 -0
  2. lintrunner-0.10.7/.github/workflows/Lint.yml +59 -0
  3. lintrunner-0.10.7/.lintrunner.toml +13 -0
  4. {lintrunner-0.10.6 → lintrunner-0.10.7}/CHANGELOG.md +11 -0
  5. {lintrunner-0.10.6 → lintrunner-0.10.7}/Cargo.lock +108 -43
  6. {lintrunner-0.10.6 → lintrunner-0.10.7}/Cargo.toml +1 -1
  7. {lintrunner-0.10.6 → lintrunner-0.10.7}/PKG-INFO +3 -1
  8. {lintrunner-0.10.6 → lintrunner-0.10.7}/README.md +2 -0
  9. {lintrunner-0.10.6 → lintrunner-0.10.7}/examples/rustfmt_linter.py +24 -16
  10. {lintrunner-0.10.6 → lintrunner-0.10.7}/run-maturin-action.sh +2 -1
  11. {lintrunner-0.10.6 → lintrunner-0.10.7}/rustfmt.toml +1 -0
  12. {lintrunner-0.10.6 → lintrunner-0.10.7}/src/git.rs +3 -1
  13. {lintrunner-0.10.6 → lintrunner-0.10.7}/src/lint_config.rs +7 -8
  14. {lintrunner-0.10.6 → lintrunner-0.10.7}/src/linter.rs +1 -1
  15. {lintrunner-0.10.6 → lintrunner-0.10.7}/src/main.rs +10 -2
  16. {lintrunner-0.10.6 → lintrunner-0.10.7}/src/persistent_data.rs +1 -1
  17. {lintrunner-0.10.6 → lintrunner-0.10.7}/src/render.rs +7 -1
  18. {lintrunner-0.10.6 → lintrunner-0.10.7}/tests/integration_test.rs +1 -0
  19. {lintrunner-0.10.6 → lintrunner-0.10.7}/.gitignore +0 -0
  20. {lintrunner-0.10.6 → lintrunner-0.10.7}/LICENSE +0 -0
  21. {lintrunner-0.10.6 → lintrunner-0.10.7}/cliff.toml +0 -0
  22. {lintrunner-0.10.6 → lintrunner-0.10.7}/do_release.sh +0 -0
  23. {lintrunner-0.10.6 → lintrunner-0.10.7}/examples/config_example.toml +0 -0
  24. {lintrunner-0.10.6 → lintrunner-0.10.7}/examples/flake8_linter.py +0 -0
  25. {lintrunner-0.10.6 → lintrunner-0.10.7}/pyproject.toml +0 -0
  26. {lintrunner-0.10.6 → lintrunner-0.10.7}/src/init.rs +0 -0
  27. {lintrunner-0.10.6 → lintrunner-0.10.7}/src/lib.rs +0 -0
  28. {lintrunner-0.10.6 → lintrunner-0.10.7}/src/lint_message.rs +0 -0
  29. {lintrunner-0.10.6 → lintrunner-0.10.7}/src/log_utils.rs +0 -0
  30. {lintrunner-0.10.6 → lintrunner-0.10.7}/src/path.rs +0 -0
  31. {lintrunner-0.10.6 → lintrunner-0.10.7}/src/rage.rs +0 -0
  32. {lintrunner-0.10.6 → lintrunner-0.10.7}/tests/fixtures/fake_source_file.rs +0 -0
  33. {lintrunner-0.10.6 → lintrunner-0.10.7}/tests/snapshots/integration_test__changed_init_causes_warning_1.snap +0 -0
  34. {lintrunner-0.10.6 → lintrunner-0.10.7}/tests/snapshots/integration_test__changed_init_causes_warning_2.snap +0 -0
  35. {lintrunner-0.10.6 → lintrunner-0.10.7}/tests/snapshots/integration_test__duplicate_code_fails.snap +0 -0
  36. {lintrunner-0.10.6 → lintrunner-0.10.7}/tests/snapshots/integration_test__empty_command_fails.snap +0 -0
  37. {lintrunner-0.10.6 → lintrunner-0.10.7}/tests/snapshots/integration_test__excluding_dryrun_fails.snap +0 -0
  38. {lintrunner-0.10.6 → lintrunner-0.10.7}/tests/snapshots/integration_test__format_command_doesnt_use_nonformat_linter.snap +0 -0
  39. {lintrunner-0.10.6 → lintrunner-0.10.7}/tests/snapshots/integration_test__git_head_files.snap +0 -0
  40. {lintrunner-0.10.6 → lintrunner-0.10.7}/tests/snapshots/integration_test__git_no_changes.snap +0 -0
  41. {lintrunner-0.10.6 → lintrunner-0.10.7}/tests/snapshots/integration_test__init_suppresses_warning.snap +0 -0
  42. {lintrunner-0.10.6 → lintrunner-0.10.7}/tests/snapshots/integration_test__invalid_args.snap +0 -0
  43. {lintrunner-0.10.6 → lintrunner-0.10.7}/tests/snapshots/integration_test__invalid_config_fails.snap +0 -0
  44. {lintrunner-0.10.6 → lintrunner-0.10.7}/tests/snapshots/integration_test__invalid_paths_cmd_and_from.snap +0 -0
  45. {lintrunner-0.10.6 → lintrunner-0.10.7}/tests/snapshots/integration_test__invalid_paths_cmd_and_specified_paths.snap +0 -0
  46. {lintrunner-0.10.6 → lintrunner-0.10.7}/tests/snapshots/integration_test__linter_hard_failure_is_caught.snap +0 -0
  47. {lintrunner-0.10.6 → lintrunner-0.10.7}/tests/snapshots/integration_test__linter_nonexistent_command.snap +0 -0
  48. {lintrunner-0.10.6 → lintrunner-0.10.7}/tests/snapshots/integration_test__linter_providing_nonexistent_path_degrades_gracefully.snap +0 -0
  49. {lintrunner-0.10.6 → lintrunner-0.10.7}/tests/snapshots/integration_test__linter_replacement_trailing_newlines.snap +0 -0
  50. {lintrunner-0.10.6 → lintrunner-0.10.7}/tests/snapshots/integration_test__no_op_config_succeeds.snap +0 -0
  51. {lintrunner-0.10.6 → lintrunner-0.10.7}/tests/snapshots/integration_test__rage_command_output.snap +0 -0
  52. {lintrunner-0.10.6 → lintrunner-0.10.7}/tests/snapshots/integration_test__simple_linter.snap +0 -0
  53. {lintrunner-0.10.6 → lintrunner-0.10.7}/tests/snapshots/integration_test__simple_linter_fails_on_nonexistent_file.snap +0 -0
  54. {lintrunner-0.10.6 → lintrunner-0.10.7}/tests/snapshots/integration_test__simple_linter_oneline.snap +0 -0
  55. {lintrunner-0.10.6 → lintrunner-0.10.7}/tests/snapshots/integration_test__simple_linter_replacement_message.snap +0 -0
  56. {lintrunner-0.10.6 → lintrunner-0.10.7}/tests/snapshots/integration_test__skip_nonexistent_linter.snap +0 -0
  57. {lintrunner-0.10.6 → lintrunner-0.10.7}/tests/snapshots/integration_test__take_nonexistent_linter.snap +0 -0
  58. {lintrunner-0.10.6 → lintrunner-0.10.7}/tests/snapshots/integration_test__tee_json.snap +0 -0
  59. {lintrunner-0.10.6 → lintrunner-0.10.7}/tests/snapshots/integration_test__unknown_config_fails.snap +0 -0
  60. {lintrunner-0.10.6 → lintrunner-0.10.7}/tools/convert_to_sarif.py +0 -0
  61. {lintrunner-0.10.6 → lintrunner-0.10.7}/tools/convert_to_sarif_test.py +0 -0
@@ -8,6 +8,10 @@ on:
8
8
  tags:
9
9
  - v*
10
10
 
11
+ concurrency:
12
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }}
13
+ cancel-in-progress: true
14
+
11
15
  jobs:
12
16
  test:
13
17
  strategy:
@@ -0,0 +1,59 @@
1
+ name: Lint
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ tags:
8
+ - v*
9
+ pull_request:
10
+
11
+ concurrency:
12
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }}
13
+ cancel-in-progress: true
14
+
15
+ jobs:
16
+ lintrunner:
17
+ name: lintrunner
18
+ strategy:
19
+ fail-fast: false
20
+ matrix:
21
+ os: [ubuntu-latest, windows-latest]
22
+ python_version: ["3.11"]
23
+
24
+ runs-on: ${{ matrix.os }}
25
+ steps:
26
+ - uses: actions/checkout@v3
27
+ - name: Setup Python
28
+ uses: actions/setup-python@v4
29
+ with:
30
+ python-version: ${{ matrix.python_version }}
31
+ - name: Install Lintrunner
32
+ run: |
33
+ pip install .
34
+ lintrunner init
35
+ - name: Run lintrunner on all files - Linux
36
+ if: matrix.os != 'windows-latest'
37
+ run: |
38
+ set +e
39
+ if ! lintrunner -v --force-color --all-files --tee-json=lint.json; then
40
+ echo ""
41
+ echo -e "\e[1m\e[36mYou can reproduce these results locally by using \`lintrunner -m main\`.\e[0m"
42
+ exit 1
43
+ fi
44
+ - name: Run lintrunner on all files - Windows
45
+ if: matrix.os == 'windows-latest'
46
+ run: lintrunner -v --force-color --all-files
47
+ - name: Produce SARIF
48
+ if: always() && matrix.os == 'ubuntu-latest'
49
+ run: |
50
+ python tools/convert_to_sarif.py --input lint.json --output lintrunner.sarif
51
+ - name: Upload SARIF file
52
+ if: always() && matrix.os == 'ubuntu-latest'
53
+ continue-on-error: true
54
+ uses: github/codeql-action/upload-sarif@v2
55
+ with:
56
+ # Path to SARIF file relative to the root of the repository
57
+ sarif_file: lintrunner.sarif
58
+ category: lintrunner
59
+ checkout_path: ${{ github.workspace }}
@@ -0,0 +1,13 @@
1
+ merge_base_with="main"
2
+
3
+ [[linter]]
4
+ code = 'RUSTFMT'
5
+ include_patterns = ['**/*.rs']
6
+ command = [
7
+ 'python',
8
+ 'examples/rustfmt_linter.py',
9
+ '--binary=rustfmt',
10
+ '--config-path=rustfmt.toml',
11
+ '--',
12
+ '@{{PATHSFILE}}'
13
+ ]
@@ -2,6 +2,17 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [0.10.7] - 2023-03-02
6
+
7
+ ### Bug Fixes
8
+
9
+ - Run clippy and rustfmt; fix issues ([#34](https://github.com/suo/lintrunner/issues/34)) ([b0e8be2](https://github.com/suo/lintrunner/commit/b0e8be295e5a0e959f36ea740b95780a9abe7400))
10
+ - Fix and enable rustfmt linter ([#35](https://github.com/suo/lintrunner/issues/35)) ([507d273](https://github.com/suo/lintrunner/commit/507d27314283fd5c6acede4e75800766921e358d))
11
+
12
+ ### Features
13
+
14
+ - Enable setting default --merge-base-with values ([75ea9c0](https://github.com/suo/lintrunner/commit/75ea9c09cd6904e6e53170af0661fd3dcb39c9e9))
15
+
5
16
  ## [0.10.5] - 2023-01-19
6
17
 
7
18
  ### Bug Fixes
@@ -33,9 +33,9 @@ dependencies = [
33
33
 
34
34
  [[package]]
35
35
  name = "anyhow"
36
- version = "1.0.68"
36
+ version = "1.0.69"
37
37
  source = "registry+https://github.com/rust-lang/crates.io-index"
38
- checksum = "2cb2f989d18dd141ab8ae82f64d1a8cdd37e0840f73a406896cf5e99502fab61"
38
+ checksum = "224afbd727c3d6e4b90103ece64b8d1b67fbb1973b1046c2281eed3f3803f800"
39
39
 
40
40
  [[package]]
41
41
  name = "arrayref"
@@ -111,9 +111,9 @@ dependencies = [
111
111
 
112
112
  [[package]]
113
113
  name = "bstr"
114
- version = "1.2.0"
114
+ version = "1.3.0"
115
115
  source = "registry+https://github.com/rust-lang/crates.io-index"
116
- checksum = "b7f0778972c64420fdedc63f09919c8a88bda7b25135357fd25a5d9f3257e832"
116
+ checksum = "5ffdb39cb703212f3c11973452c2861b972f757b021158f3516ba10f2fa8b2c1"
117
117
  dependencies = [
118
118
  "memchr",
119
119
  "once_cell",
@@ -224,7 +224,7 @@ dependencies = [
224
224
  "lazy_static",
225
225
  "libc",
226
226
  "unicode-width",
227
- "windows-sys",
227
+ "windows-sys 0.42.0",
228
228
  ]
229
229
 
230
230
  [[package]]
@@ -260,9 +260,9 @@ dependencies = [
260
260
 
261
261
  [[package]]
262
262
  name = "cxx"
263
- version = "1.0.89"
263
+ version = "1.0.91"
264
264
  source = "registry+https://github.com/rust-lang/crates.io-index"
265
- checksum = "bc831ee6a32dd495436e317595e639a587aa9907bef96fe6e6abc290ab6204e9"
265
+ checksum = "86d3488e7665a7a483b57e25bdd90d0aeb2bc7608c8d0346acf2ad3f1caf1d62"
266
266
  dependencies = [
267
267
  "cc",
268
268
  "cxxbridge-flags",
@@ -272,9 +272,9 @@ dependencies = [
272
272
 
273
273
  [[package]]
274
274
  name = "cxx-build"
275
- version = "1.0.89"
275
+ version = "1.0.91"
276
276
  source = "registry+https://github.com/rust-lang/crates.io-index"
277
- checksum = "94331d54f1b1a8895cd81049f7eaaaef9d05a7dcb4d1fd08bf3ff0806246789d"
277
+ checksum = "48fcaf066a053a41a81dfb14d57d99738b767febb8b735c3016e469fac5da690"
278
278
  dependencies = [
279
279
  "cc",
280
280
  "codespan-reporting",
@@ -287,15 +287,15 @@ dependencies = [
287
287
 
288
288
  [[package]]
289
289
  name = "cxxbridge-flags"
290
- version = "1.0.89"
290
+ version = "1.0.91"
291
291
  source = "registry+https://github.com/rust-lang/crates.io-index"
292
- checksum = "48dcd35ba14ca9b40d6e4b4b39961f23d835dbb8eed74565ded361d93e1feb8a"
292
+ checksum = "a2ef98b8b717a829ca5603af80e1f9e2e48013ab227b68ef37872ef84ee479bf"
293
293
 
294
294
  [[package]]
295
295
  name = "cxxbridge-macro"
296
- version = "1.0.89"
296
+ version = "1.0.91"
297
297
  source = "registry+https://github.com/rust-lang/crates.io-index"
298
- checksum = "81bbeb29798b407ccd82a3324ade1a7286e0d29851475990b612670f6f5124d2"
298
+ checksum = "086c685979a698443656e5cf7856c95c642295a38599f12fb1ff76fb28d19892"
299
299
  dependencies = [
300
300
  "proc-macro2",
301
301
  "quote",
@@ -369,11 +369,32 @@ version = "0.3.6"
369
369
  source = "registry+https://github.com/rust-lang/crates.io-index"
370
370
  checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f"
371
371
 
372
+ [[package]]
373
+ name = "errno"
374
+ version = "0.2.8"
375
+ source = "registry+https://github.com/rust-lang/crates.io-index"
376
+ checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1"
377
+ dependencies = [
378
+ "errno-dragonfly",
379
+ "libc",
380
+ "winapi",
381
+ ]
382
+
383
+ [[package]]
384
+ name = "errno-dragonfly"
385
+ version = "0.1.2"
386
+ source = "registry+https://github.com/rust-lang/crates.io-index"
387
+ checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf"
388
+ dependencies = [
389
+ "cc",
390
+ "libc",
391
+ ]
392
+
372
393
  [[package]]
373
394
  name = "fastrand"
374
- version = "1.8.0"
395
+ version = "1.9.0"
375
396
  source = "registry+https://github.com/rust-lang/crates.io-index"
376
- checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499"
397
+ checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be"
377
398
  dependencies = [
378
399
  "instant",
379
400
  ]
@@ -487,9 +508,9 @@ dependencies = [
487
508
 
488
509
  [[package]]
489
510
  name = "insta"
490
- version = "1.26.0"
511
+ version = "1.28.0"
491
512
  source = "registry+https://github.com/rust-lang/crates.io-index"
492
- checksum = "f6f0f08b46e4379744de2ab67aa8f7de3ffd1da3e275adc41fcc82053ede46ff"
513
+ checksum = "fea5b3894afe466b4bcf0388630fc15e11938a6074af0cd637c825ba2ec8a099"
493
514
  dependencies = [
494
515
  "console",
495
516
  "lazy_static",
@@ -510,6 +531,16 @@ dependencies = [
510
531
  "cfg-if",
511
532
  ]
512
533
 
534
+ [[package]]
535
+ name = "io-lifetimes"
536
+ version = "1.0.5"
537
+ source = "registry+https://github.com/rust-lang/crates.io-index"
538
+ checksum = "1abeb7a0dd0f8181267ff8adc397075586500b81b28a73e8a0208b00fc170fb3"
539
+ dependencies = [
540
+ "libc",
541
+ "windows-sys 0.45.0",
542
+ ]
543
+
513
544
  [[package]]
514
545
  name = "itertools"
515
546
  version = "0.10.5"
@@ -563,7 +594,7 @@ checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f"
563
594
 
564
595
  [[package]]
565
596
  name = "lintrunner"
566
- version = "0.10.6"
597
+ version = "0.10.7"
567
598
  dependencies = [
568
599
  "anyhow",
569
600
  "assert_cmd",
@@ -589,6 +620,12 @@ dependencies = [
589
620
  "toml",
590
621
  ]
591
622
 
623
+ [[package]]
624
+ name = "linux-raw-sys"
625
+ version = "0.1.4"
626
+ source = "registry+https://github.com/rust-lang/crates.io-index"
627
+ checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4"
628
+
592
629
  [[package]]
593
630
  name = "log"
594
631
  version = "0.4.17"
@@ -631,9 +668,9 @@ checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3"
631
668
 
632
669
  [[package]]
633
670
  name = "once_cell"
634
- version = "1.17.0"
671
+ version = "1.17.1"
635
672
  source = "registry+https://github.com/rust-lang/crates.io-index"
636
- checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66"
673
+ checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3"
637
674
 
638
675
  [[package]]
639
676
  name = "os_str_bytes"
@@ -643,9 +680,9 @@ checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee"
643
680
 
644
681
  [[package]]
645
682
  name = "pest"
646
- version = "2.5.4"
683
+ version = "2.5.5"
647
684
  source = "registry+https://github.com/rust-lang/crates.io-index"
648
- checksum = "4ab62d2fa33726dbe6321cc97ef96d8cde531e3eeaf858a058de53a8a6d40d8f"
685
+ checksum = "028accff104c4e513bad663bbcd2ad7cfd5304144404c31ed0a77ac103d00660"
649
686
  dependencies = [
650
687
  "thiserror",
651
688
  "ucd-trie",
@@ -653,9 +690,9 @@ dependencies = [
653
690
 
654
691
  [[package]]
655
692
  name = "pest_derive"
656
- version = "2.5.4"
693
+ version = "2.5.5"
657
694
  source = "registry+https://github.com/rust-lang/crates.io-index"
658
- checksum = "8bf026e2d0581559db66d837fe5242320f525d85c76283c61f4d51a1238d65ea"
695
+ checksum = "2ac3922aac69a40733080f53c1ce7f91dcf57e1a5f6c52f421fadec7fbdc4b69"
659
696
  dependencies = [
660
697
  "pest",
661
698
  "pest_generator",
@@ -663,9 +700,9 @@ dependencies = [
663
700
 
664
701
  [[package]]
665
702
  name = "pest_generator"
666
- version = "2.5.4"
703
+ version = "2.5.5"
667
704
  source = "registry+https://github.com/rust-lang/crates.io-index"
668
- checksum = "2b27bd18aa01d91c8ed2b61ea23406a676b42d82609c6e2581fba42f0c15f17f"
705
+ checksum = "d06646e185566b5961b4058dd107e0a7f56e77c3f484549fb119867773c0f202"
669
706
  dependencies = [
670
707
  "pest",
671
708
  "pest_meta",
@@ -676,9 +713,9 @@ dependencies = [
676
713
 
677
714
  [[package]]
678
715
  name = "pest_meta"
679
- version = "2.5.4"
716
+ version = "2.5.5"
680
717
  source = "registry+https://github.com/rust-lang/crates.io-index"
681
- checksum = "9f02b677c1859756359fc9983c2e56a0237f18624a3789528804406b7e915e5d"
718
+ checksum = "e6f60b2ba541577e2a0c307c8f39d1439108120eb7903adeb6497fa880c59616"
682
719
  dependencies = [
683
720
  "once_cell",
684
721
  "pest",
@@ -738,9 +775,9 @@ dependencies = [
738
775
 
739
776
  [[package]]
740
777
  name = "proc-macro2"
741
- version = "1.0.50"
778
+ version = "1.0.51"
742
779
  source = "registry+https://github.com/rust-lang/crates.io-index"
743
- checksum = "6ef7d57beacfaf2d8aee5937dab7b7f28de3cb8b1828479bb5de2a7106f2bae2"
780
+ checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6"
744
781
  dependencies = [
745
782
  "unicode-ident",
746
783
  ]
@@ -798,12 +835,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
798
835
  checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848"
799
836
 
800
837
  [[package]]
801
- name = "remove_dir_all"
802
- version = "0.5.3"
838
+ name = "rustix"
839
+ version = "0.36.8"
803
840
  source = "registry+https://github.com/rust-lang/crates.io-index"
804
- checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7"
841
+ checksum = "f43abb88211988493c1abb44a70efa56ff0ce98f233b7b276146f1f3f7ba9644"
805
842
  dependencies = [
806
- "winapi",
843
+ "bitflags",
844
+ "errno",
845
+ "io-lifetimes",
846
+ "libc",
847
+ "linux-raw-sys",
848
+ "windows-sys 0.45.0",
807
849
  ]
808
850
 
809
851
  [[package]]
@@ -840,9 +882,9 @@ dependencies = [
840
882
 
841
883
  [[package]]
842
884
  name = "serde_json"
843
- version = "1.0.91"
885
+ version = "1.0.93"
844
886
  source = "registry+https://github.com/rust-lang/crates.io-index"
845
- checksum = "877c235533714907a8c2464236f5c4b2a17262ef1bd71f38f35ea592c8da6883"
887
+ checksum = "cad406b69c91885b5107daf2c29572f6c8cdb3c66826821e286c533490c0bc76"
846
888
  dependencies = [
847
889
  "itoa",
848
890
  "ryu",
@@ -892,9 +934,9 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601"
892
934
 
893
935
  [[package]]
894
936
  name = "syn"
895
- version = "1.0.107"
937
+ version = "1.0.109"
896
938
  source = "registry+https://github.com/rust-lang/crates.io-index"
897
- checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5"
939
+ checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
898
940
  dependencies = [
899
941
  "proc-macro2",
900
942
  "quote",
@@ -903,16 +945,15 @@ dependencies = [
903
945
 
904
946
  [[package]]
905
947
  name = "tempfile"
906
- version = "3.3.0"
948
+ version = "3.4.0"
907
949
  source = "registry+https://github.com/rust-lang/crates.io-index"
908
- checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4"
950
+ checksum = "af18f7ae1acd354b992402e9ec5864359d693cd8a79dcbef59f76891701c1e95"
909
951
  dependencies = [
910
952
  "cfg-if",
911
953
  "fastrand",
912
- "libc",
913
954
  "redox_syscall",
914
- "remove_dir_all",
915
- "winapi",
955
+ "rustix",
956
+ "windows-sys 0.42.0",
916
957
  ]
917
958
 
918
959
  [[package]]
@@ -1159,6 +1200,30 @@ dependencies = [
1159
1200
  "windows_x86_64_msvc",
1160
1201
  ]
1161
1202
 
1203
+ [[package]]
1204
+ name = "windows-sys"
1205
+ version = "0.45.0"
1206
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1207
+ checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0"
1208
+ dependencies = [
1209
+ "windows-targets",
1210
+ ]
1211
+
1212
+ [[package]]
1213
+ name = "windows-targets"
1214
+ version = "0.42.1"
1215
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1216
+ checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7"
1217
+ dependencies = [
1218
+ "windows_aarch64_gnullvm",
1219
+ "windows_aarch64_msvc",
1220
+ "windows_i686_gnu",
1221
+ "windows_i686_msvc",
1222
+ "windows_x86_64_gnu",
1223
+ "windows_x86_64_gnullvm",
1224
+ "windows_x86_64_msvc",
1225
+ ]
1226
+
1162
1227
  [[package]]
1163
1228
  name = "windows_aarch64_gnullvm"
1164
1229
  version = "0.42.1"
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "lintrunner"
3
- version = "0.10.6"
3
+ version = "0.10.7"
4
4
  authors = ["Michael Suo <suo@fb.com>"]
5
5
  edition = "2021"
6
6
  description = "A lint running tool and framework."
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lintrunner
3
- Version: 0.10.6
3
+ Version: 0.10.7
4
4
  Classifier: Programming Language :: Rust
5
5
  Classifier: Programming Language :: Python :: Implementation :: CPython
6
6
  Classifier: Programming Language :: Python :: Implementation :: PyPy
@@ -97,6 +97,8 @@ file, conventionally named `.lintrunner.toml`.
97
97
  Here is an example linter configuration:
98
98
 
99
99
  ```toml
100
+ merge_base_with = 'main'
101
+
100
102
  [[linter]]
101
103
  name = 'FLAKE8'
102
104
  include_patterns = [
@@ -82,6 +82,8 @@ file, conventionally named `.lintrunner.toml`.
82
82
  Here is an example linter configuration:
83
83
 
84
84
  ```toml
85
+ merge_base_with = 'main'
86
+
85
87
  [[linter]]
86
88
  name = 'FLAKE8'
87
89
  include_patterns = [
@@ -1,3 +1,5 @@
1
+ from __future__ import annotations
2
+
1
3
  import argparse
2
4
  import concurrent.futures
3
5
  import json
@@ -8,7 +10,7 @@ import subprocess
8
10
  import sys
9
11
  import time
10
12
  from enum import Enum
11
- from typing import Any, List, NamedTuple, Optional, Pattern
13
+ from typing import Any, BinaryIO, List, NamedTuple, Optional, Pattern
12
14
 
13
15
 
14
16
  IS_WINDOWS: bool = os.name == "nt"
@@ -56,16 +58,20 @@ def strip_path_from_error(error: str) -> str:
56
58
 
57
59
 
58
60
  def run_command(
59
- args: List[str],
60
- ) -> "subprocess.CompletedProcess[bytes]":
61
+ args: list[str],
62
+ *,
63
+ stdin: BinaryIO | None = None,
64
+ check: bool = False,
65
+ ) -> subprocess.CompletedProcess[bytes]:
61
66
  logging.debug("$ %s", " ".join(args))
62
67
  start_time = time.monotonic()
63
68
  try:
64
69
  return subprocess.run(
65
70
  args,
66
- stdout=subprocess.PIPE,
67
- stderr=subprocess.PIPE,
68
- check=True,
71
+ capture_output=True,
72
+ shell=False,
73
+ stdin=stdin,
74
+ check=check,
69
75
  )
70
76
  finally:
71
77
  end_time = time.monotonic()
@@ -80,16 +86,18 @@ def check_file(
80
86
  try:
81
87
  with open(filename, "rb") as f:
82
88
  original = f.read()
83
- proc = run_command(
84
- [
85
- binary,
86
- "--config-path",
87
- config_path,
88
- "--emit=stdout",
89
- "--quiet",
90
- filename,
91
- ]
92
- )
89
+ with open(filename, "rb") as f:
90
+ proc = run_command(
91
+ [
92
+ binary,
93
+ "--config-path",
94
+ config_path,
95
+ "--emit=stdout",
96
+ "--quiet",
97
+ ],
98
+ stdin=f,
99
+ check=True,
100
+ )
93
101
  except (OSError, subprocess.CalledProcessError) as err:
94
102
  # https://github.com/rust-lang/rustfmt#running
95
103
  # TODO: Fix the syntax error regexp to handle multiple issues and
@@ -6,10 +6,11 @@ export PATH="$HOME/.cargo/bin:$PATH"
6
6
  rustup override set stable
7
7
  rustup component add llvm-tools-preview || true
8
8
  echo "::endgroup::"
9
- export PATH="$PATH:/opt/python/cp36-cp36m/bin:/opt/python/cp37-cp37m/bin:/opt/python/cp38-cp38/bin:/opt/python/cp39-cp39/bin"
9
+ export PATH="$PATH:/opt/python/cp37-cp37m/bin:/opt/python/cp38-cp38/bin:/opt/python/cp39-cp39/bin:/opt/python/cp310-cp310/bin:/opt/python/cp311-cp311/bin"
10
10
  echo "::group::Install maturin"
11
11
  curl -L https://github.com/PyO3/maturin/releases/download/v0.12.20/maturin-x86_64-unknown-linux-musl.tar.gz | tar -xz -C /usr/local/bin
12
12
  maturin --version || true
13
13
  which patchelf > /dev/null || python3 -m pip install patchelf
14
+ python3 -m pip install cffi || true
14
15
  echo "::endgroup::"
15
16
  maturin build --release -o target/dist
@@ -2,4 +2,5 @@
2
2
  # Please keep these in alphabetical order.
3
3
  edition = "2018"
4
4
  merge_derives = false
5
+ newline_style = "Native"
5
6
  use_field_init_shorthand = true
@@ -18,7 +18,9 @@ pub fn get_head() -> Result<String> {
18
18
  pub fn get_paths_from_cmd(paths_cmd: &str) -> Result<Vec<AbsPath>> {
19
19
  debug!("Running paths_cmd: {}", paths_cmd);
20
20
  if paths_cmd.is_empty() {
21
- return Err(anyhow::Error::msg("paths_cmd is empty. Please provide an executable command."));
21
+ return Err(anyhow::Error::msg(
22
+ "paths_cmd is empty. Please provide an executable command.",
23
+ ));
22
24
  }
23
25
  let argv = shell_words::split(paths_cmd).context("failed to split paths_cmd")?;
24
26
  debug!("Parsed paths_cmd: {:?}", argv);
@@ -10,6 +10,11 @@ use serde::{Deserialize, Serialize};
10
10
  pub struct LintRunnerConfig {
11
11
  #[serde(rename = "linter")]
12
12
  pub linters: Vec<LintConfig>,
13
+
14
+ /// The default value for the `merge_base_with` parameter.
15
+ /// Recommend setting this is set to your default branch, e.g. `main`
16
+ #[serde()]
17
+ pub merge_base_with: Option<String>,
13
18
  }
14
19
 
15
20
  fn is_false(b: &bool) -> bool {
@@ -173,10 +178,7 @@ pub fn get_linters_from_config(
173
178
  );
174
179
  }
175
180
 
176
- linters = linters
177
- .into_iter()
178
- .filter(|linter| taken_linters.contains(&linter.code))
179
- .collect();
181
+ linters.retain(|linter| taken_linters.contains(&linter.code));
180
182
  }
181
183
 
182
184
  // Apply --skip
@@ -190,10 +192,7 @@ pub fn get_linters_from_config(
190
192
  all_linters,
191
193
  );
192
194
  }
193
- linters = linters
194
- .into_iter()
195
- .filter(|linter| !skipped_linters.contains(&linter.code))
196
- .collect();
195
+ linters.retain(|linter| !skipped_linters.contains(&linter.code));
197
196
  }
198
197
  Ok(linters)
199
198
  }
@@ -160,7 +160,7 @@ impl Linter {
160
160
  original: None,
161
161
  replacement: None,
162
162
  };
163
- return vec![err_lint];
163
+ vec![err_lint]
164
164
  }
165
165
  Ok(messages) => messages,
166
166
  }
@@ -6,6 +6,7 @@ use clap::Parser;
6
6
 
7
7
  use lintrunner::{
8
8
  do_init, do_lint,
9
+ git::get_head,
9
10
  init::check_init_changed,
10
11
  lint_config::{get_linters_from_config, LintRunnerConfig},
11
12
  log_utils::setup_logger,
@@ -13,11 +14,11 @@ use lintrunner::{
13
14
  persistent_data::{ExitInfo, PersistentDataStore, RunInfo},
14
15
  rage::do_rage,
15
16
  render::print_error,
16
- PathsOpt, RenderOpt, RevisionOpt, git::get_head,
17
+ PathsOpt, RenderOpt, RevisionOpt,
17
18
  };
18
19
  use log::debug;
19
20
 
20
- const VERSION: &'static str = env!("CARGO_PKG_VERSION");
21
+ const VERSION: &str = env!("CARGO_PKG_VERSION");
21
22
 
22
23
  #[derive(Debug, Parser)]
23
24
  #[clap(version, name = "lintrunner", infer_subcommands(true))]
@@ -211,6 +212,13 @@ fn do_main() -> Result<i32> {
211
212
  RevisionOpt::Revision(revision)
212
213
  } else if let Some(merge_base_with) = args.merge_base_with {
213
214
  RevisionOpt::MergeBaseWith(merge_base_with)
215
+ } else if lint_runner_config.merge_base_with.is_some() {
216
+ RevisionOpt::MergeBaseWith(
217
+ lint_runner_config
218
+ .merge_base_with
219
+ .clone()
220
+ .expect("Merge base should be defined"),
221
+ )
214
222
  } else {
215
223
  RevisionOpt::Head
216
224
  };
@@ -47,7 +47,7 @@ impl RunInfo {
47
47
  // this run.
48
48
  fn dir_name(&self) -> String {
49
49
  let args = blake3::hash(self.args.join("_").as_bytes()).to_string();
50
- self.timestamp.clone().replace(":", "-").replace("+", "_") + "_" + &args
50
+ self.timestamp.clone().replace(':', "-").replace('+', "_") + "_" + &args
51
51
  }
52
52
  }
53
53
 
@@ -54,7 +54,13 @@ pub fn render_lint_messages_oneline(
54
54
  writeln!(
55
55
  stdout,
56
56
  "{}:{}:{} :{} {} [{}/{}]",
57
- display_path, line_number, column, severity, description, lint_message.code, lint_message.name
57
+ display_path,
58
+ line_number,
59
+ column,
60
+ severity,
61
+ description,
62
+ lint_message.code,
63
+ lint_message.name
58
64
  )?;
59
65
  }
60
66
 
@@ -47,6 +47,7 @@ fn temp_config_returning_msg(lint_message: LintMessage) -> Result<tempfile::Name
47
47
  let serialized = serde_json::to_string(&lint_message)?;
48
48
  let config = temp_config(&format!(
49
49
  "\
50
+ merge_base = \"some_base\"
50
51
  [[linter]]
51
52
  code = 'TESTLINTER'
52
53
  include_patterns = ['**']
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes