Git Product home page Git Product logo

bazel-linting-system's Introduction

πŸ‘‹ Hi there, thanks for stopping by

I'm here a lot, building data-intensive products from the ground up. I'm bullish on, and a big booster of:

  • modal.com! Truly cloud-native application development. The fastest way to run code in the cloud.
  • πŸŒΏπŸ’š @bazelbuild and generally using functional principles to keep things sane. (I've open-sourced a few tools for the Bazel ecosystem, see below)
  • Good old-fashioned books πŸ“–. Two recent favourites are The Plot Against America and The Netanyahus.
  • Effective Altruism. Helping, not harming. Doing, not having. Building, not consuming. (Mosquito nets, not the SBF/FTX-style embarassment)

Active Projects

Past Projects

  • Growing Python in the Bazel ecosystem. See various projects in my pins. I previously did maintenance duty for bazelbuild/rules_python. Unfortunately, I no longer have time to dedicate to the ecosystem.
    • whitelist.sh - A goal-oriented, calendar aware content feed that I would have wanted to use during my undergrad. πŸ‘·πŸ»β€β™‚οΈ

Computing is pop culture. [...] Pop culture holds a disdain for history. Pop culture is all about identity and feeling like you're participating, It has nothing to do with cooperation, the past or the futureβ€”it's living in the present. I think the same is true of most people who write code for money. They have no idea where [their culture came from]. - Alan Kay

bazel-linting-system's People

Contributors

thundergolfer avatar thundergolfer-two avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

bazel-linting-system's Issues

Produce diffs as output not full file mirrors

Description

Currently this project is going outputting a full mirror of the source code it lints. In cases where there are no linting errors across a workspace then the mirrored source code is identical to the original and thus totally wasteful.

If instead a diff-like file was output the disk space utilisation would probably be like 90% smaller.

License information is missing

There is no license information in the repository that I can find. If it's meant to be proprietary, I suppose that isn't actually needed, but then it's nice to have some "All rights reserved" comments in the code so it's clear that's the intention. If it's meant to be open source, a license needs to be chosen. See e.g. https://docs.github.com/en/free-pro-team@latest/github/building-a-strong-community/adding-a-license-to-a-repository

The Apache 2.0 license seems to be quite popular among Bazel people, if you're open for a suggestion.

Cannot run on macOS

I'd like to know the recommended environment to run the example.

e.g., the operating system, the bazel version.

I am on macOS 11.6, intel chip, with bazel version 4.2.

I cd into the example directory and run lint.sh; however, I encounter this error:

Loading: 
Loading: 0 packages loaded
Analyzing: 12 targets (0 packages loaded, 0 targets configured)
INFO: Repository rubocop instantiated at:
  /Users/matthew/Drive/dev/depot/bazel/bazel-linting-system/examples/WORKSPACE:104:16: in <toplevel>
  /private/var/tmp/_bazel_matthew/7bc05c15c9d5b26f74aeafb78fd96ea8/external/io_tweag_rules_nixpkgs/nixpkgs/nixpkgs.bzl:195:25: in nixpkgs_package
Repository rule _nixpkgs_package defined at:
  /private/var/tmp/_bazel_matthew/7bc05c15c9d5b26f74aeafb78fd96ea8/external/io_tweag_rules_nixpkgs/nixpkgs/nixpkgs.bzl:168:35: in <toplevel>
ERROR: An error occurred during the fetch of repository 'rubocop':
   Traceback (most recent call last):
	File "/private/var/tmp/_bazel_matthew/7bc05c15c9d5b26f74aeafb78fd96ea8/external/io_tweag_rules_nixpkgs/nixpkgs/nixpkgs.bzl", line 136, column 13, in _nixpkgs_package_impl
		fail("Platform is not supported (see 'fail_not_supported')")
Error in fail: Platform is not supported (see 'fail_not_supported')
ERROR: Error fetching repository: Traceback (most recent call last):
	File "/private/var/tmp/_bazel_matthew/7bc05c15c9d5b26f74aeafb78fd96ea8/external/io_tweag_rules_nixpkgs/nixpkgs/nixpkgs.bzl", line 136, column 13, in _nixpkgs_package_impl
		fail("Platform is not supported (see 'fail_not_supported')")
Error in fail: Platform is not supported (see 'fail_not_supported')
ERROR: /Users/matthew/Drive/dev/depot/bazel/bazel-linting-system/examples/tools/linting/BUILD:31:7: //tools/linting:ruby depends on @rubocop//:exe in repository @rubocop which failed to fetch. no such package '@rubocop//': Platform is not supported (see 'fail_not_supported')
ERROR: Analysis of target '//tools/linting:ruby' failed; build aborted: Analysis failed
INFO: Elapsed time: 0.142s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (2 packages loaded, 0 targets configured)
FAILED: Build did NOT complete successfully (2 packages loaded, 0 targets configured)

Reporting mode

Description

Currently this project just edits the source. It can't say what was wrong or why it was wrong.

Implementing this could easily make the linter rule awkward to configure. Currently there's a config_str that can be used to make sure that 'in-place fix mode' in ON. Perhaps there's should be a fix_config_str and report_config_str to clearly mark out how to configure the linter rule for both modes.

bazel-skylib is an unlisted dependency of this project

https://github.com/bazelbuild/bazel-skylib

Got this error when adding bazel-linting-system to a new project:

Starting local Bazel server and connecting to it...
INFO: Writing tracer profile to '/private/var/tmp/_bazel_jonathonbelotti/f8ff68f081f4f3b674dcf62a28548591/command.profile.gz'
ERROR: in /Users/jonathonbelotti/Code/thundergolfer/bazel-mypy-integration/examples/tools/linting/aspect.bzl: in /private/var/tmp/_bazel_jonathonbelotti/f8ff68f081f4f3b674dcf62a28548591/external/linting_system/generator.bzl: Unable to find package for @bazel_skylib//lib:shell.bzl: The repository '@bazel_skylib' could not be resolved.
ERROR: Analysis of aspect '//tools/linting:aspect.bzl%lint of //hangman:hangman' failed; build aborted: in /Users/jonathonbelotti/Code/thundergolfer/bazel-mypy-integration/examples/tools/linting/aspect.bzl: in /private/var/tmp/_bazel_jonathonbelotti/f8ff68f081f4f3b674dcf62a28548591/external/linting_system/generator.bzl: Unable to find package for @bazel_skylib//lib:shell.bzl: The repository '@bazel_skylib' could not be resolved.
INFO: Elapsed time: 5.388s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (4 packages loaded, 0 targets config\
ured)
    currently loading: @bazel_tools//tools/cpp ... (2 packages)

[Tracking] Supported languages

Description

Below is a compatibility table. It includes the top 25 TIOBE languages and relevant languages from 25-50 (eg. Scala). For these languages, the table shows Bazel Support which is whether there are Bazel rules for the language, and Project Support which is whether there is a linter for the language that can integrate with this project.

| βœ… | βœ… | -> πŸŽ‰
| βœ… | ❌ | -> Not compatible with project, or compatibility yet to be demonstrated.
| ❌ | ❌ | -> No Bazel compatibility, thus no compatibility with this project.


Language Tiobe Index Rank (2019) Bazel Support Project Support
Java 1 βœ… βœ…
C 2 ❔ ❌
Python 3 βœ… βœ…
C++ 4 βœ… βœ…
C# 5 βœ… ❌
Visual Basic .NET 6 ❔ ❌
Javascript 7 βœ… ❌
PHP 8 ❌ ❌
SQL 9 ❌ ❌
Swift 10 βœ… ❌
Ruby 11 βœ… βœ…
Objective-C 12 βœ… ❌
Delphi 13 ❌ ❌
Groovy 14 βœ… ❌
Assembly 15 ❌ ❌
R 16 ❌ ❌
Visual Basic 17 ❌ ❌
D 18 βœ… ❌
MATLAB 19 ❌ ❌
Golang 20 βœ… βœ…
Perl 21 βœ… ❌
SAS 22 ❌ ❌
Dart 24 ❌ ❌
Rust 25 βœ… ❌
Scala 30 βœ… ❌
Kotlin 35 βœ… ❌
Typescript 43 βœ… ❌
Haskell 44 βœ… ❌
Bash 48 βœ… ❌
Jsonnet ?? βœ… βœ…
Protobuf ?? βœ… ❌

lint python does not work

When using lint black it creates a __linting_system folder in the bazel-out, but when copying these files to the original folder with

bazel run @linting_system//:apply_changes -- \
  "$(git rev-parse --show-toplevel)" \
  "$(bazel info bazel-genfiles)"

it simply doesn't copy. I guess it's because after /__linting_system/ it uses the target name and then the folder structure from the project root, but I'm not sure that's it.

apply_changes doesn't find __linting_system deep in the tree

The linting system produces directories called __linting_system under the bazel-genfiles directory, sometimes several directories deep, if the project under analysis has Bazel subpackages. Then apply_changes tries to find them using

	lintSysPkgRootPattern := genfilesRoot + "/**/__linting_system"
	matches, err := filepath.Glob(lintSysPkgRootPattern)

The problem is that filepath.Glob does not support ** in the pattern string. (See also https://golang.org/pkg/path/filepath/#Glob and https://golang.org/pkg/path/filepath/#Match β€” there's only * which matches "non-Separator characters". There's also https://stackoverflow.com/questions/26809484/how-to-use-double-star-glob-in-go)

The effect becomes that no changes get applied for our nested subpackages.

Version: Current master, 7701c83.
Expected behavior: Changes are applied from all the __linting_system directories in bazel-genfiles.
Actual behavior: Changes from subpackages are skipped.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.