initial commit

This commit is contained in:
2025-03-08 19:29:14 +01:00
parent 18bfd99401
commit 1c66feaa2a
323 changed files with 20550 additions and 1 deletions

View File

@@ -0,0 +1 @@
3.8

View File

@@ -0,0 +1,11 @@
{
"@python": 3,
"linters": {
"flake8": {
"max-line-length": 120
},
"pep8": {
"max-line-length": 120
}
}
}

View File

@@ -0,0 +1,17 @@
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.

View File

@@ -0,0 +1,60 @@
SublimeLinter-perlcritic
========================
This linter plugin for
[SublimeLinter](https://github.com/SublimeLinter/SublimeLinter3) provides an
interface to the [perlcritic](https://metacpan.org/pod/perlcritic).
It will be used with files that have the "Perl" syntax.
## Installation
SublimeLinter 3 must be installed in order to use this plugin. If
SublimeLinter 3 is not installed, please follow the instructions
[here](http://www.sublimelinter.com/en/latest/installation.html).
### Linter installation
Before installing this plugin, you must ensure that `perlcritic` is installed
on your system. To install `perlcritic`, type `cpanm perlcritic`.
### Plugin installation
Please use [Package Control](https://sublime.wbond.net/installation) to
install the linter plugin. This will ensure that the plugin will be updated
when new versions are available. If you want to install from source so you can
modify the source code, you probably know what you are doing so we wont cover
that here.
To install via Package Control, do the following:
1. Within Sublime Text, bring up the [Command
Palette](http://docs.sublimetext.info/en/sublime-text-3/extensibility/command_palette.html)
and type `install`. Among the commands you should see `Package Control:
Install Package`. If that command is not highlighted, use the keyboard or
mouse to select it. There will be a pause of a few seconds while Package
Control fetches the list of available plugins.
2. When the plugin list appears, type `perlcritic`. Among the entries you
should see `SublimeLinter-perlcritic`. If that entry is not highlighted, use
the keyboard or mouse to select it.
## Settings
For general information on how SublimeLinter works with settings, please see
[Settings](http://www.sublimelinter.com/en/latest/settings.html).
For information on generic linter settings, please see
[Linter Settings](http://www.sublimelinter.com/en/latest/linter_settings.html).
## Contributing
If you would like to contribute enhancements or fixes, please do the
following:
1. Fork the plugin repository.
2. Hack on a separate topic branch created from the latest `master`.
3. Commit and push the topic branch.
4. Make a pull request.
5. Be patient. ;-)
Please note that modifications should follow these coding guidelines:
- Indent is 4 spaces.
- Code should pass flake8 and pep257 linters.
- Vertical whitespace helps readability, dont be afraid to use it.
Thank you for helping out!

View File

@@ -0,0 +1,101 @@
#
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Gregory Oschwald (based on linter by Aparajita Fishman)
# Copyright (c) 2013 Gregory Oschwald, Aparajita Fishman
#
# License: MIT
#
"""This module exports the PerlCritic linter class."""
import os
from SublimeLinter.lint import Linter
#-----------------------------------------------------------------------------
#
# sl3_util_climb & sl3_util_find_file
#
# Sublime Linter 4 retired util.climb and util.find_file and by doing so
# this linter was rendered unusable. We are making copies of the retired
# code here to still be able to find configuration files for perlcritic
# looking upwards among directories in the project.
#
def sl3_util_climb(start_dir, limit=None):
"""
Generate directories, starting from start_dir.
If limit is None, stop at the root directory.
Otherwise return a maximum of limit directories.
"""
right = True
while right and (limit is None or limit > 0):
yield start_dir
start_dir, right = os.path.split(start_dir)
if limit is not None:
limit -= 1
def sl3_util_find_file(start_dir, name, parent=False, limit=None, aux_dirs=[]):
"""
Find the given file by searching up the file hierarchy from start_dir.
If the file is found and parent is False, returns the path to the file.
If parent is True the path to the file's parent directory is returned.
If limit is None, the search will continue up to the root directory.
Otherwise a maximum of limit directories will be checked.
If aux_dirs is not empty and the file hierarchy search failed,
those directories are also checked.
"""
for d in sl3_util_climb(start_dir, limit=limit):
target = os.path.join(d, name)
if os.path.exists(target):
if parent:
return d
return target
for d in aux_dirs:
d = os.path.expanduser(d)
target = os.path.join(d, name)
if os.path.exists(target):
if parent:
return d
return target
#-----------------------------------------------------------------------------
class PerlCritic(Linter):
"""Provides an interface to perlcritic."""
executable = 'perlcritic'
regex = r'\[.+\] (?P<message>.+?) at line (?P<line>\d+), column (?P<col>\d+).+?'
defaults = {
'selector': 'source.modernperl, source.perl'
}
def cmd(self):
"""Return a tuple with the command line to execute."""
command = [self.executable, '--verbose', '8']
config = sl3_util_find_file(
os.path.dirname(self.filename), '.perlcriticrc'
)
if config:
command += ['-p', config]
return command

View File

@@ -0,0 +1,3 @@
{
"install": "messages/install.txt"
}

View File

@@ -0,0 +1,12 @@
SublimeLinter-perlcritic
-------------------------------
This linter plugin for SublimeLinter provides an interface to perlcritic.
Installation
------------
In order to use this plugin, please install
[perlcritic](https://metacpan.org/pod/perlcritic).
Please see https://github.com/oschwald/SublimeLinter-perlcritic/ for more
detailed instructions.

View File

@@ -0,0 +1 @@
{"name": "SublimeLinter-contrib-perlcritic", "version": "1.2.1", "sublime_text": ">=3000", "platforms": ["*"], "python_version": "3.3", "url": "https://github.com/oschwald/SublimeLinter-perlcritic", "issues": "https://github.com/oschwald/SublimeLinter-perlcritic/issues", "author": ["oschwald"], "description": "perlcritic linter for SublimeLinter3", "labels": ["linting", "SublimeLinter", "perl", "perlcritic"], "libraries": [], "install_time": 1735898025.336629, "release_time": "2018-09-16 20:32:14"}