[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master c4c1bcc 18/56: Add flake8 pattern
From: |
Rocky Bernstein |
Subject: |
[elpa] master c4c1bcc 18/56: Add flake8 pattern |
Date: |
Sat, 27 May 2017 05:02:30 -0400 (EDT) |
branch: master
commit c4c1bccac46b42752f50a343ee61bfd57464cc06
Author: rocky <address@hidden>
Commit: Clément Pit--Claudel <address@hidden>
Add flake8 pattern
---
Makefile.am | 71 +-------------------------------------
realgud/common/buffer/backtrace.el | 2 +-
realgud/common/buffer/command.el | 10 +++---
realgud/debugger/ipdb/init.el | 4 +++
realgud/debugger/pdb/init.el | 4 +++
realgud/debugger/trepan2/init.el | 4 +++
realgud/debugger/trepan3k/init.el | 4 +++
realgud/lang/python.el | 20 +++++++++++
test/test-regexp-python.el | 64 ++++++++++++++++++++++++++++++++++
9 files changed, 106 insertions(+), 77 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 647de4e..f525b99 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,70 +1 @@
-# Note: This makefile include remake-style target comments.
-# These comments before the targets start with #:
-# remake --tasks to shows the targets and the comments
-
-SUBDIRS = realgud test
-
-GIT2CL ?= git2cl
-RUBY ?= ruby
-
-lispdir = @lispdir@
-
-PHONY=check clean dist distclean test check-short check-terse install-short
-
-lisp_files = $(wildcard *.el)
-lisp_LISP = $(lisp_files)
-EXTRA_DIST=common.mk README.md INSTALL.md THANKS etc/.nosearch
realgud/.nosearch $(lisp_files)
-
-include common.mk
-
-if MAINTAINER_MODE
-
-#: Remove change log: ChangeLog
-rmChangeLog:
- rm ChangeLog || true
-
-#: Create a ChangeLog file from git logs
-ChangeLog: rmChangeLog
- git log --pretty --numstat --summary | $(GIT2CL) > $@
-
-ACLOCAL_AMFLAGS=-I .
-
-endif
-
-#: Run all tests
-test: check
-
-#: Run all tests without bloated output
-check-short:
- $(MAKE) check 2>&1 | $(RUBY) test/make-check-filter.rb
-
-#: Run all tests without and show just the failure lines
-check-terse:
- $(MAKE) check 2>&1 | $(RUBY) tes/make-check-filter.rb | grep failure
-
-#: Run "make install"
-install-short:
- $(MAKE) install 2>&1 | $(RUBY) test/make-check-filter.rb
-
-.PHONY: test check check-short rmChangeLog check_copyrights
-
-CR_EXCEPTIONS=cr_exceptions.txt
-#: Check that copyrights are assigned to FSF
-check_copyrights:
- @echo "Compute exceptions >$(CR_EXCEPTIONS)~"
- @export LC_ALL=C; \
- (cd $(top_srcdir) && \
- find . -name '.git' -prune -o \
- -name 'test' -prune -o \
- -name '*.el' -print0 | \
- xargs -0 grep -L 'Free Software Foundation, Inc' | \
- grep -v '\(\.dir-locals\|.-\(pkg\|autoloads\)\)\.el$$'; \
- find . -name '.git' -prune -o -name '*.el' -type f -print | \
- while read f; do \
- fquoted="$$(echo $$f|tr '|' '_')"; \
- sed -n -e '/[Cc]opyright.*, *[1-9][-0-9]*,\?$$/N' \
- -e '/Free Software Foundation/d' \
- -e "s|^\\(.*[Cc]opyright\\)|$$fquoted:\\1|p" \
- "$$f"; \
- done) | sort >$(CR_EXCEPTIONS)~
- diff -u "$(CR_EXCEPTIONS)" "$(CR_EXCEPTIONS)~"
+SUBDIRS = realgud
diff --git a/realgud/common/buffer/backtrace.el
b/realgud/common/buffer/backtrace.el
index 9f05c93..816ffdb 100644
--- a/realgud/common/buffer/backtrace.el
+++ b/realgud/common/buffer/backtrace.el
@@ -38,7 +38,7 @@
(declare-function realgud:file-loc-from-line 'realgud-file)
(declare-function realgud:loc-describe 'realgud-loc)
-(defstruct realgud-backtrace-info
+(cl-defstruct realgud-backtrace-info
"debugger object/structure specific to a (top-level) program to be debugged."
(cmdbuf nil) ;; buffer of the associated debugger process
(cur-pos 0) ;; Frame we are at
diff --git a/realgud/common/buffer/command.el b/realgud/common/buffer/command.el
index b68226c..bd8aaca 100644
--- a/realgud/common/buffer/command.el
+++ b/realgud/common/buffer/command.el
@@ -53,7 +53,7 @@
:version "24.3")
-(defstruct realgud-cmdbuf-info
+(cl-defstruct realgud-cmdbuf-info
"The debugger object/structure specific to a process buffer."
debugger-name ;; Name of debugger
base-variable-name ;; prefix used in variables pertinent to this
@@ -165,7 +165,7 @@ Information is put in an internal buffer called *Describe*."
(setq buffer (realgud-get-cmdbuf buffer))
(if buffer
(with-current-buffer buffer
- (let ((info realgud-cmdbuf-info)
+ (lexical-let ((info realgud-cmdbuf-info)
(cmdbuf-name (buffer-name)))
(if info
(progn
@@ -178,10 +178,8 @@ Information is put in an internal buffer called
*Describe*."
(insert "** General Information (")
(insert-text-button
"realgud-cmdbuf-info"
- 'buffer buffer
- 'action (lambda (b)
- (with-current-buffer (button-get b 'buffer)
- (describe-variable 'realgud-cmdbuf-info)))
+ ;; FIXME figure out how to set buffer to cmdbuf so we get
cmdbuf value
+ 'action (lambda(button) (describe-variable
'realgud-cmdbuf-info))
'help-echo "mouse-2: help-on-variable")
(insert ")\n")
diff --git a/realgud/debugger/ipdb/init.el b/realgud/debugger/ipdb/init.el
index 1a59fb0..d83a4fd 100644
--- a/realgud/debugger/ipdb/init.el
+++ b/realgud/debugger/ipdb/init.el
@@ -62,6 +62,10 @@ realgud-loc-pat struct")
(setf (gethash "pytest-error" realgud:ipdb-pat-hash)
realgud-pytest-error-loc-pat)
+;; Regular expression that describes location in a flake8 message
+(setf (gethash "flake8-msg" realgud:ipdb-pat-hash)
+ realgud-flake8-msg-loc-pat)
+
;; realgud-loc-pat that describes a "breakpoint set" line. For example:
;; Breakpoint 1 at /usr/bin/ipdb:7
(setf (gethash "brkpt-set" realgud:ipdb-pat-hash)
diff --git a/realgud/debugger/pdb/init.el b/realgud/debugger/pdb/init.el
index 7068758..cf0f743 100644
--- a/realgud/debugger/pdb/init.el
+++ b/realgud/debugger/pdb/init.el
@@ -61,6 +61,10 @@ realgud-loc-pat struct")
(setf (gethash "pytest-error" realgud:pdb-pat-hash)
realgud-pytest-error-loc-pat)
+;; Regular expression that describes location in a flake8 message
+(setf (gethash "flake8-msg" realgud:pdb-pat-hash)
+ realgud-flake8-msg-loc-pat)
+
;; Regular expression that describes a "breakpoint set" line. For example:
;; Breakpoint 1 at /usr/bin/pdb:7
(setf (gethash "brkpt-set" realgud:pdb-pat-hash)
diff --git a/realgud/debugger/trepan2/init.el b/realgud/debugger/trepan2/init.el
index 2f13fa7..7d05ed3 100644
--- a/realgud/debugger/trepan2/init.el
+++ b/realgud/debugger/trepan2/init.el
@@ -65,6 +65,10 @@ realgud-loc-pat struct")
(setf (gethash "pytest-error" realgud:trepan2-pat-hash)
realgud-pytest-error-loc-pat)
+;; Regular expression that describes location in a flake8 message
+(setf (gethash "flake8-msg" realgud:trepan2-pat-hash)
+ realgud-flake8-msg-loc-pat)
+
;; Regular expression that describes a "breakpoint set" line
(setf (gethash "brkpt-set" realgud:trepan2-pat-hash)
realgud:python-trepan-brkpt-set-pat)
diff --git a/realgud/debugger/trepan3k/init.el
b/realgud/debugger/trepan3k/init.el
index d74f24d..6749ed3 100644
--- a/realgud/debugger/trepan3k/init.el
+++ b/realgud/debugger/trepan3k/init.el
@@ -71,6 +71,10 @@ realgud-loc-pat struct")
(setf (gethash "pytest-error" realgud:trepan3k-pat-hash)
realgud-pytest-error-loc-pat)
+;; Regular expression that describes location in a flake8 message
+(setf (gethash "flake8-msg" realgud:trepan3k-pat-hash)
+ realgud-flake8-msg-loc-pat)
+
;; realgud-loc-pat that describes a "breakpoint set" line
(setf (gethash "brkpt-set" realgud:trepan3k-pat-hash)
realgud:python-trepan-brkpt-set-pat)
diff --git a/realgud/lang/python.el b/realgud/lang/python.el
index a2e8b54..2f41136 100644
--- a/realgud/lang/python.el
+++ b/realgud/lang/python.el
@@ -42,6 +42,7 @@ traceback) line." )
(define-key map (kbd "C-c !b") 'realgud:goto-debugger-backtrace-line)
(define-key map (kbd "C-c !!") 'realgud:goto-lang-backtrace-line)
(define-key map (kbd "C-c !e") 'realgud:pytest-goto-errmsg-line)
+ (define-key map (kbd "C-c !8") 'realgud:flake8-goto-msg-line)
)
@@ -173,4 +174,23 @@ traceback) line." )
(realgud-goto-line-for-pt pt "pytest-error"))
+(defconst realgud-flake8-msg-loc-pat
+ (make-realgud-loc-pat
+ :regexp "^\\(.*\\):\\([0-9]+\\):\\([0-9]+\\): [EW]\\([0-9]+\\) "
+ :file-group 1
+ :line-group 2
+ :char-offset-group 3
+ )
+ "A realgud-loc-pat struct that describes a flake8 warning or error line"
+ )
+
+
+;; FIXME: there is probably a less redundant way to do the following
+;; FNS.
+(defun realgud:flake8-goto-msg-line (pt)
+ "Display the location mentioned by the flake8 warning or error."
+ (interactive "d")
+ (realgud-goto-line-for-pt pt "flake8-msg"))
+
+
(provide-me "realgud-lang-")
diff --git a/test/test-regexp-python.el b/test/test-regexp-python.el
new file mode 100644
index 0000000..35301c2
--- /dev/null
+++ b/test/test-regexp-python.el
@@ -0,0 +1,64 @@
+;; Press C-x C-e at the end of the next line to run this file test
non-interactively
+;; (test-simple-run "emacs -batch -L %s -l %s" (file-name-directory
(locate-library "test-simple.elc")) buffer-file-name)
+
+(require 'test-simple)
+(load-file "../realgud/lang/python.el")
+(load-file "./regexp-helper.el")
+
+(declare-function __FILE__ 'load-relative)
+(declare-function prompt-match 'regexp-helper)
+
+(test-simple-start)
+
+(eval-when-compile
+ (defvar loc-pat) (defvar realgud:flake8-msg-loc-pat)
+ (defvar test-text)
+ )
+
+;; FIXME: we get a void variable somewhere in here when running
+;; even though we define it in lexical-let. Dunno why.
+;; setq however will workaround this.
+(note "flake8 testing")
+
+(setq test-text
+ "uncompyle6/parsers/parse3.py:441:17: W503 line break before binary
operator")
+
+(assert-t (numberp (loc-match test-text realgud-flake8-msg-loc-pat))
+ "flake8 warning")
+
+(assert-equal "uncompyle6/parsers/parse3.py"
+ (match-string (realgud-loc-pat-file-group
realgud-flake8-msg-loc-pat)
+ test-text))
+
+(assert-equal "441"
+ (match-string (realgud-loc-pat-line-group
realgud-flake8-msg-loc-pat)
+ test-text))
+
+(assert-equal "17"
+ (match-string (realgud-loc-pat-char-offset-group
realgud-flake8-msg-loc-pat)
+ test-text))
+
+(setq test-text
+ "/uncompyle6/main.py:53:1: E303 too many blank lines (3)")
+
+
+(assert-t (numberp (loc-match test-text realgud-flake8-msg-loc-pat))
+ "flake8 error")
+
+(assert-equal "/uncompyle6/main.py"
+ (match-string (realgud-loc-pat-file-group
realgud-flake8-msg-loc-pat)
+ test-text))
+
+(assert-equal "53"
+ (match-string (realgud-loc-pat-line-group
realgud-flake8-msg-loc-pat)
+ test-text))
+
+(assert-equal "1"
+ (match-string (realgud-loc-pat-char-offset-group
realgud-flake8-msg-loc-pat)
+ test-text))
+
+;; FIXME add pytest testing
+;; (note "pytest testing")
+
+
+(end-tests)
- [elpa] master 447ab36 08/56: host removing ansi-schmutz to mode setting., (continued)
- [elpa] master 447ab36 08/56: host removing ansi-schmutz to mode setting., Rocky Bernstein, 2017/05/27
- [elpa] master 9df42fe 12/56: Towards tracking breakpoints more often, Rocky Bernstein, 2017/05/27
- [elpa] master 4246e34 17/56: Merge pull request #150 from realgud/breakpoint-display, Rocky Bernstein, 2017/05/27
- [elpa] master 0fd9f62 35/56: lint on test, Rocky Bernstein, 2017/05/27
- [elpa] master 52d6b82 23/56: Closer to getting column info used, Rocky Bernstein, 2017/05/27
- [elpa] master 7fac416 29/56: Increase flake8 message coverage..., Rocky Bernstein, 2017/05/27
- [elpa] master 20b8d5d 32/56: Use cl-lib names, Rocky Bernstein, 2017/05/27
- [elpa] master 4f57d25 27/56: Fixes PR review realgud/realgud#163, Rocky Bernstein, 2017/05/27
- [elpa] master f360ead 31/56: Allow nil as file parameter in realgud-exec-shell, Rocky Bernstein, 2017/05/27
- [elpa] master 4b0bde7 33/56: realgud-file-find-function is in realgud group, Rocky Bernstein, 2017/05/27
- [elpa] master c4c1bcc 18/56: Add flake8 pattern,
Rocky Bernstein <=
- [elpa] master df6921b 37/56: Merge branch 'master' of github.com:realgud/realgud, Rocky Bernstein, 2017/05/27
- [elpa] master f73b937 39/56: Initalize local-variable realgd:jdb-file-remap, Rocky Bernstein, 2017/05/27
- [elpa] master 392573c 44/56: Merge branch 'master' of github.com:realgud/realgud, Rocky Bernstein, 2017/05/27
- [elpa] master 7915661 42/56: Initalize local-variable realgd:jdb-file-remap, Rocky Bernstein, 2017/05/27
- [elpa] master ea21fd6 22/56: field char-offset -> column, Rocky Bernstein, 2017/05/27
- [elpa] master da5fbd6 46/56: Fix up automake install, Rocky Bernstein, 2017/05/27
- [elpa] master f7012d4 45/56: Small cleanups, Rocky Bernstein, 2017/05/27
- [elpa] master a0af8eb 54/56: Add trepan2-delayed and trepan3k-delayed, Rocky Bernstein, 2017/05/27
- [elpa] master 0220e92 50/56: Merge pull request #175 from Apteryks/patch-1, Rocky Bernstein, 2017/05/27
- [elpa] master 1bfe1e6 49/56: Honor debugger-name in trepan2-suggest-invocation, Rocky Bernstein, 2017/05/27