diff --git a/.all-contributorsrc b/.all-contributorsrc index 163b1a1c8c..49cbdc61ba 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -987,7 +987,8 @@ "avatar_url": "https://avatars.githubusercontent.com/u/12729644?v=4", "profile": "https://github.com/Clint-Chester", "contributions": [ - "code", "bug" + "code", + "bug" ] }, { @@ -6427,8 +6428,18 @@ "contributions": [ "bug" ] + }, + { + "login": "kevingnet", + "name": "Kevin Guerra", + "avatar_url": "https://avatars.githubusercontent.com/u/5151740?v=4", + "profile": "https://github.com/kevingnet", + "contributions": [ + "code" + ] } ], "contributorsPerLine": 7, - "contributorsSortAlphabetically": true + "contributorsSortAlphabetically": true, + "skipCi": true } diff --git a/docs/_config.yml b/docs/_config.yml index ca829f79b7..0e5f147a3d 100644 --- a/docs/_config.yml +++ b/docs/_config.yml @@ -2,7 +2,7 @@ repository: pmd/pmd pmd: version: 7.0.0-SNAPSHOT - previous_version: 6.38.0 + previous_version: 6.39.0 date: ??-?????-2021 release_type: major diff --git a/docs/pages/next_major_development.md b/docs/pages/next_major_development.md index 97d9c9329d..10b51e34d8 100644 --- a/docs/pages/next_major_development.md +++ b/docs/pages/next_major_development.md @@ -246,6 +246,10 @@ the breaking API changes will be performed in 7.0.0. an API is tagged as `@Deprecated` or not in the latest minor release. During the development of 7.0.0, we may decide to remove some APIs that were not tagged as deprecated, though we'll try to avoid it." %} +#### 6.39.0 + +No changes. + #### 6.38.0 No changes. diff --git a/docs/pages/pmd/projectdocs/credits.md b/docs/pages/pmd/projectdocs/credits.md index 0059d376f0..e2c76b6ce6 100644 --- a/docs/pages/pmd/projectdocs/credits.md +++ b/docs/pages/pmd/projectdocs/credits.md @@ -375,545 +375,546 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
Keve MΓΌller

πŸ› +
Kevin Guerra

πŸ’»
Kevin Jones

πŸ›
Kevin Wayne

πŸ›
Kieran Black

πŸ›
Kirill Zubov

πŸ›
Kirk Clemens

πŸ’» πŸ› -
Klaus Hartl

πŸ› +
Klaus Hartl

πŸ›
Koen Van Looveren

πŸ›
Kris Scheibe

πŸ’» πŸ›
Kunal Thanki

πŸ›
Larry Diamond

πŸ’» πŸ›
Lars Knickrehm

πŸ›
Leo Gutierrez

πŸ› -
Lintsi

πŸ› +
Lintsi

πŸ›
Linus Fernandes

πŸ›
Lixon Lookose

πŸ›
Logesh

πŸ›
Lorenzo Gabriele

πŸ›
LoΓ―c Ledoyen

πŸ›
Lucas Silva

πŸ› -
Lucas Soncini

πŸ’» πŸ› +
Lucas Soncini

πŸ’» πŸ›
Lukasz Slonina

πŸ›
Lukebray

πŸ›
Lyor Goldstein

πŸ›
MCMicS

πŸ›
Macarse

πŸ›
Machine account for PMD

πŸ’» -
Maciek Siemczyk

πŸ› +
Maciek Siemczyk

πŸ›
Maikel Steneker

πŸ’» πŸ›
Maksim Moiseikin

πŸ›
Manfred Koch

πŸ›
Manuel Moya Ferrer

πŸ’» πŸ›
Manuel Ryan

πŸ›
Marat Vyshegorodtsev

πŸ› -
Marcel HΓ€rle

πŸ› +
Marcel HΓ€rle

πŸ›
Marcello Fialho

πŸ›
Marcin Rataj

πŸ›
Mark Adamcin

πŸ›
Mark Hall

πŸ’» πŸ›
Mark Kolich

πŸ›
Mark Pritchard

πŸ› -
Markus Rathgeb

πŸ› +
Markus Rathgeb

πŸ›
Marquis Wang

πŸ›
Martin Feldsztejn

πŸ›
Martin Lehmann

πŸ›
Martin Spamer

πŸ›
Martin TarjΓ‘nyi

πŸ›
MatFl

πŸ› -
Mateusz Stefanski

πŸ› +
Mateusz Stefanski

πŸ›
Mathieu Gouin

πŸ›
MatiasComercio

πŸ’» πŸ›
Matt Benson

πŸ›
Matt De Poorter

πŸ›
Matt Harrah

πŸ›
Matt Nelson

πŸ› -
Matthew Amos

πŸ› +
Matthew Amos

πŸ›
Matthew Duggan

πŸ›
Matthew Hall

πŸ›
MatΓ­as Fraga

πŸ’» πŸ›
Maxime Robert

πŸ’» πŸ›
Michael

πŸ›
Michael Bell

πŸ› -
Michael Bernstein

πŸ› +
Michael Bernstein

πŸ›
Michael Clay

πŸ›
Michael Dombrowski

πŸ›
Michael Hausegger

πŸ›
Michael Hoefer

πŸ›
Michael MΓΆbius

πŸ›
Michael N. Lipp

πŸ› -
Michael Pellegrini

πŸ› +
Michael Pellegrini

πŸ›
Michal Kordas

πŸ›
MichaΕ‚ Borek

πŸ›
MichaΕ‚ KuliΕ„ski

πŸ›
Miguel NΓΊΓ±ez DΓ­az-Montes

πŸ›
Mihai Ionut

πŸ›
Mirek Hankus

πŸ› -
Mladjan Gadzic

πŸ› +
Mladjan Gadzic

πŸ›
MrAngry52

πŸ›
Muminur Choudhury

πŸ›
Mykhailo Palahuta

πŸ’» πŸ›
Nagendra Kumar Singh

πŸ›
Nahuel Barrios

πŸ›
Nathan Braun

πŸ› -
Nathan Reynolds

πŸ› +
Nathan Reynolds

πŸ›
Nathan Reynolds

πŸ›
NathanaΓ«l

πŸ›
Nazdravi

πŸ›
Neha-Dhonde

πŸ›
Nicholas Doyle

πŸ›
Nick Butcher

πŸ› -
Nico Gallinal

πŸ› +
Nico Gallinal

πŸ›
Nicola Dal Maso

πŸ›
Nikita Chursin

πŸ›
Niklas Baudy

πŸ›
Nikolas Havrikov

πŸ›
Nilesh Virkar

πŸ›
Nimit Patel

πŸ› -
Niranjan Harpale

πŸ› +
Niranjan Harpale

πŸ›
Noah Sussman

πŸ›
Noah0120

πŸ›
Noam Tamim

πŸ›
Noel Grandin

πŸ›
Olaf Haalstra

πŸ›
Oleg Pavlenko

πŸ› -
Oliver Eikemeier

πŸ› +
Oliver Eikemeier

πŸ›
Olivier Parent

πŸ’» πŸ›
Ollie Abbey

πŸ’» πŸ›
OverDrone

πŸ›
Ozan Gulle

πŸ’» πŸ›
PUNEET JAIN

πŸ›
Parbati Bose

πŸ› -
Paul Berg

πŸ› +
Paul Berg

πŸ›
Pavel Bludov

πŸ›
Pavel Mička

πŸ›
Pedro Nuno Santos

πŸ›
Pedro Rijo

πŸ›
Pelisse Romain

πŸ’» πŸ“– πŸ›
Pete Davids

πŸ› -
Peter Bruin

πŸ› +
Peter Bruin

πŸ›
Peter Chittum

πŸ’» πŸ›
Peter Cudmore

πŸ›
Peter Kasson

πŸ›
Peter Kofler

πŸ›
Pham Hai Trung

πŸ›
Philip Graf

πŸ’» πŸ› -
Philip Hachey

πŸ› +
Philip Hachey

πŸ›
Philippe Ozil

πŸ›
Phinehas Artemix

πŸ›
Phokham Nonava

πŸ›
Piotr SzymaΕ„ski

πŸ›
Piotrek Ε»ygieΕ‚o

πŸ’» πŸ›
Pranay Jaiswal

πŸ› -
Prasad Kamath

πŸ› +
Prasad Kamath

πŸ›
Prasanna

πŸ›
Presh-AR

πŸ›
Puneet1726

πŸ›
Rafael CortΓͺs

πŸ›
RaheemShaik999

πŸ›
RajeshR

πŸ’» πŸ› -
Ramachandra Mohan

πŸ› +
Ramachandra Mohan

πŸ›
Raquel Pau

πŸ›
Ravikiran Janardhana

πŸ›
Reda Benhemmouche

πŸ›
Renato Oliveira

πŸ’» πŸ›
Rich DiCroce

πŸ›
Riot R1cket

πŸ› -
Rishabh Jain

πŸ› +
Rishabh Jain

πŸ›
RishabhDeep Singh

πŸ›
Robbie Martinus

πŸ’» πŸ›
Robert Henry

πŸ›
Robert Painsi

πŸ›
Robert Russell

πŸ›
Robert SΓΆsemann

πŸ’» πŸ“– πŸ“’ πŸ› -
Robert Whitebit

πŸ› +
Robert Whitebit

πŸ›
Robin Richtsfeld

πŸ›
Robin Stocker

πŸ’» πŸ›
Robin Wils

πŸ›
RochusOest

πŸ›
Rodolfo Noviski

πŸ›
Rodrigo Casara

πŸ› -
Rodrigo Fernandes

πŸ› +
Rodrigo Fernandes

πŸ›
Roman Salvador

πŸ’» πŸ›
Ronald Blaschke

πŸ›
RΓ³bert Papp

πŸ›
Saikat Sengupta

πŸ›
Saksham Handu

πŸ›
Saladoc

πŸ› -
Salesforce Bob Lightning

πŸ› +
Salesforce Bob Lightning

πŸ›
Sam Carlberg

πŸ›
Satoshi Kubo

πŸ›
Scott Kennedy

πŸ›
Scott Wells

πŸ›
Sebastian BΓΆgl

πŸ›
Sebastian Schuberth

πŸ› -
Sebastian Schwarz

πŸ› +
Sebastian Schwarz

πŸ›
Sergey Gorbaty

πŸ›
Sergey Kozlov

πŸ›
Sergey Yanzin

πŸ’» πŸ›
Shubham

πŸ’» πŸ›
Simon Xiao

πŸ›
Srinivasan Venkatachalam

πŸ› -
Stanislav Gromov

πŸ› +
Stanislav Gromov

πŸ›
Stefan Birkner

πŸ›
Stefan Bohn

πŸ›
Stefan Endrullis

πŸ›
Stefan KlΓΆss-Schuster

πŸ›
Stefan Wolf

πŸ›
Stephan H. Wissel

πŸ› -
Stephen

πŸ› +
Stephen

πŸ›
Stephen Friedrich

πŸ›
Stexxe

πŸ›
Stian LΓ₯gstad

πŸ›
StuartClayton5

πŸ›
Supun Arunoda

πŸ›
Suren Abrahamyan

πŸ› -
SwatiBGupta1110

πŸ› +
SwatiBGupta1110

πŸ›
SyedThoufich

πŸ›
Szymon Sasin

πŸ›
T-chuangxin

πŸ›
TERAI Atsuhiro

πŸ›
TIOBE Software

πŸ’» πŸ›
Taylor Smock

πŸ› -
Techeira DamiΓ‘n

πŸ’» πŸ› +
Techeira DamiΓ‘n

πŸ’» πŸ›
Ted Husted

πŸ›
TehBakker

πŸ›
The Gitter Badger

πŸ›
Theodoor

πŸ›
Thiago Henrique HΓΌpner

πŸ›
Thibault Meyer

πŸ› -
Thomas GΓΌttler

πŸ› +
Thomas GΓΌttler

πŸ›
Thomas Jones-Low

πŸ›
Thomas Smith

πŸ’» πŸ›
ThrawnCA

πŸ›
Thunderforge

πŸ’» πŸ›
Tim van der Lippe

πŸ›
Tobias Weimer

πŸ’» πŸ› -
Tom Daly

πŸ› +
Tom Daly

πŸ›
Tomer Figenblat

πŸ›
Tomi De Lucca

πŸ’» πŸ›
Torsten Kleiber

πŸ›
TrackerSB

πŸ›
Ullrich Hafner

πŸ›
Utku Cuhadaroglu

πŸ’» πŸ› -
Valentin Brandl

πŸ› +
Valentin Brandl

πŸ›
Valeria

πŸ›
Vasily Anisimov

πŸ›
Vickenty Fesunov

πŸ›
Victor NoΓ«l

πŸ›
Vincent HUYNH

πŸ›
Vincent Maurin

πŸ› -
Vincent Privat

πŸ› +
Vincent Privat

πŸ›
Vishhwas

πŸ›
Vitaly

πŸ›
Vitaly Polonetsky

πŸ›
Vojtech Polivka

πŸ›
Vsevolod Zholobov

πŸ›
Wang Shidong

πŸ› -
Waqas Ahmed

πŸ› +
Waqas Ahmed

πŸ›
Wayne J. Earl

πŸ›
Wchenghui

πŸ›
Will Winder

πŸ›
William Brockhus

πŸ’» πŸ›
Wilson Kurniawan

πŸ›
Wim Deblauwe

πŸ› -
Woongsik Choi

πŸ› +
Woongsik Choi

πŸ›
XenoAmess

πŸ’» πŸ›
YaroslavTER

πŸ›
Young Chan

πŸ’» πŸ›
YuJin Kim

πŸ›
Yuri Dolzhenko

πŸ›
Yurii Dubinka

πŸ› -
Zoltan Farkas

πŸ› +
Zoltan Farkas

πŸ›
Zustin

πŸ›
aaronhurst-google

πŸ›
alexmodis

πŸ›
andreoss

πŸ›
andrey81inmd

πŸ’» πŸ›
anicoara

πŸ› -
arunprasathav

πŸ› +
arunprasathav

πŸ›
asiercamara

πŸ›
astillich-igniti

πŸ’»
avesolovksyy

πŸ›
avishvat

πŸ›
avivmu

πŸ›
axelbarfod1

πŸ› -
b-3-n

πŸ› +
b-3-n

πŸ›
balbhadra9

πŸ›
base23de

πŸ›
bergander

πŸ›
berkam

πŸ’» πŸ›
breizh31

πŸ›
caesarkim

πŸ› -
carolyujing

πŸ› +
carolyujing

πŸ›
cesares-basilico

πŸ›
chrite

πŸ›
cobratbq

πŸ›
coladict

πŸ›
cosmoJFH

πŸ›
cristalp

πŸ› -
crunsk

πŸ› +
crunsk

πŸ›
cwholmes

πŸ›
cyberjj999

πŸ›
cyw3

πŸ›
d1ss0nanz

πŸ›
danbrycefairsailcom

πŸ›
dariansanity

πŸ› -
darrenmiliband

πŸ› +
darrenmiliband

πŸ›
davidburstrom

πŸ›
dbirkman-paloalto

πŸ›
deepak-patra

πŸ›
dependabot[bot]

πŸ’» πŸ›
dinesh150

πŸ›
diziaq

πŸ› -
dreaminpast123

πŸ› +
dreaminpast123

πŸ›
duanyanan

πŸ›
dutt-sanjay

πŸ›
dylanleung

πŸ›
dzeigler

πŸ›
ekkirala

πŸ›
emersonmoura

πŸ› -
fairy

πŸ› +
fairy

πŸ›
foxmason

πŸ›
frankegabor

πŸ›
frankl

πŸ›
freafrea

πŸ›
fsapatin

πŸ›
gracia19

πŸ› -
guo fei

πŸ› +
guo fei

πŸ›
gurmsc5

πŸ›
gwilymatgearset

πŸ’» πŸ›
haigsn

πŸ›
hemanshu070

πŸ›
henrik242

πŸ›
hongpuwu

πŸ› -
hvbtup

πŸ’» πŸ› +
hvbtup

πŸ’» πŸ›
igniti GmbH

πŸ›
ilovezfs

πŸ›
itaigilo

πŸ›
jakivey32

πŸ›
jbennett2091

πŸ›
jcamerin

πŸ› -
jkeener1

πŸ› +
jkeener1

πŸ›
jmetertea

πŸ›
josemanuelrolon

πŸ’» πŸ›
kabroxiko

πŸ’» πŸ›
karwer

πŸ›
kaulonline

πŸ›
kdaemonv

πŸ› -
kenji21

πŸ’» πŸ› +
kenji21

πŸ’» πŸ›
kfranic

πŸ›
khalidkh

πŸ›
krzyk

πŸ›
lasselindqvist

πŸ›
lihuaib

πŸ›
lonelyma1021

πŸ› -
lpeddy

πŸ› +
lpeddy

πŸ›
lyriccoder

πŸ›
marcelmore

πŸ›
matchbox

πŸ›
matthiaskraaz

πŸ›
meandonlyme

πŸ›
mikesive

πŸ› -
milossesic

πŸ› +
milossesic

πŸ›
mriddell95

πŸ›
mrlzh

πŸ›
msloan

πŸ›
mucharlaravalika

πŸ›
mvenneman

πŸ›
nareshl119

πŸ› -
nicolas-harraudeau-sonarsource

πŸ› +
nicolas-harraudeau-sonarsource

πŸ›
noerremark

πŸ›
novsirion

πŸ›
oggboy

πŸ›
oinume

πŸ›
orimarko

πŸ’» πŸ›
pallavi agarwal

πŸ› -
parksungrin

πŸ› +
parksungrin

πŸ›
patpatpat123

πŸ›
patriksevallius

πŸ›
pbrajesh1

πŸ›
phoenix384

πŸ›
piotrszymanski-sc

πŸ’»
plan3d

πŸ› -
poojasix

πŸ› +
poojasix

πŸ›
prabhushrikant

πŸ›
pujitha8783

πŸ›
r-r-a-j

πŸ›
raghujayjunk

πŸ›
rajeshveera

πŸ›
rajeswarreddy88

πŸ› -
recdevs

πŸ› +
recdevs

πŸ›
reudismam

πŸ’» πŸ›
rijkt

πŸ›
rillig-tk

πŸ›
rmohan20

πŸ’» πŸ›
rxmicro

πŸ›
ryan-gustafson

πŸ’» πŸ› -
sabi0

πŸ› +
sabi0

πŸ›
scais

πŸ›
sebbASF

πŸ›
sergeygorbaty

πŸ’»
shilko2013

πŸ›
simeonKondr

πŸ›
snajberk

πŸ› -
sniperrifle2004

πŸ› +
sniperrifle2004

πŸ›
snuyanzin

πŸ›
sratz

πŸ›
stonio

πŸ›
sturton

πŸ’» πŸ›
sudharmohan

πŸ›
suruchidawar

πŸ› -
svenfinitiv

πŸ› +
svenfinitiv

πŸ›
tashiscool

πŸ›
test-git-hook

πŸ›
testation21

πŸ’» πŸ›
thanosa

πŸ›
tiandiyixian

πŸ›
tobwoerk

πŸ› -
tprouvot

πŸ› +
tprouvot

πŸ›
trentchilders

πŸ›
triandicAnt

πŸ›
trishul14

πŸ›
tsui

πŸ›
winhkey

πŸ›
witherspore

πŸ› -
wjljack

πŸ› +
wjljack

πŸ›
wuchiuwong

πŸ›
xingsong

πŸ›
xioayuge

πŸ›
xnYi9wRezm

πŸ’» πŸ›
xuanuy

πŸ›
xyf0921

πŸ› -
yalechen-cyw3

πŸ› +
yalechen-cyw3

πŸ›
yasuharu-sato

πŸ›
zenglian

πŸ›
zgrzyt93

πŸ’» πŸ›
zh3ng

πŸ›
zt_soft

πŸ›
ztt79

πŸ› -
zzzzfeng

πŸ› +
zzzzfeng

πŸ›
ÁrpÑd MagosÑnyi

πŸ›
任贡杰

πŸ› diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index 9fb8b6553b..8abb75f161 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -19,22 +19,8 @@ This is a {{ site.pmd.release_type }} release. ### New and noteworthy -#### All Contributors - -PMD follows the [All Contributors](https://allcontributors.org/) specification. -Contributions of any kind welcome! - -See [credits](https://pmd.github.io/latest/pmd_projectdocs_credits.html) for our complete contributors list. - ### Fixed Issues -* core - * [#3499](https://github.com/pmd/pmd/pull/3499): \[core] Fix XPath rulechain with combined node tests -* java-errorprone - * [#3493](https://github.com/pmd/pmd/pull/3493): \[java] AvoidAccessibilityAlteration: add tests and fix rule -* plsql - * [#3487](https://github.com/pmd/pmd/issues/3487): \[plsql] Parsing exception OPEN ref_cursor_name FOR statement - ### API Changes ### External Contributions diff --git a/docs/pages/release_notes_old.md b/docs/pages/release_notes_old.md index bb4f14fc50..f4e9390553 100644 --- a/docs/pages/release_notes_old.md +++ b/docs/pages/release_notes_old.md @@ -5,6 +5,55 @@ permalink: pmd_release_notes_old.html Previous versions of PMD can be downloaded here: https://github.com/pmd/pmd/releases +## 25-September-2021 - 6.39.0 + +The PMD team is pleased to announce PMD 6.39.0. + +This is a minor release. + +### Table Of Contents + +* [New and noteworthy](#new-and-noteworthy) + * [All Contributors](#all-contributors) +* [Fixed Issues](#fixed-issues) +* [API Changes](#api-changes) +* [External Contributions](#external-contributions) +* [Stats](#stats) + +### New and noteworthy + +#### All Contributors + +PMD follows the [All Contributors](https://allcontributors.org/) specification. +Contributions of any kind welcome! + +See [credits](https://pmd.github.io/latest/pmd_projectdocs_credits.html) for our complete contributors list. + +### Fixed Issues + +* core + * [#3499](https://github.com/pmd/pmd/pull/3499): \[core] Fix XPath rulechain with combined node tests +* java-errorprone + * [#3493](https://github.com/pmd/pmd/pull/3493): \[java] AvoidAccessibilityAlteration: add tests and fix rule +* javascript + * [#3516](https://github.com/pmd/pmd/pull/3516): \[javascript] NPE while creating rule violation when specifying explicit line numbers +* plsql + * [#3487](https://github.com/pmd/pmd/issues/3487): \[plsql] Parsing exception OPEN ref_cursor_name FOR statement + * [#3515](https://github.com/pmd/pmd/issues/3515): \[plsql] Parsing exception SELECT...INTO on Associative Arrays Types + +### API Changes + +No changes. + +### External Contributions + +* [#3516](https://github.com/pmd/pmd/pull/3516): \[javascript] NPE while creating rule violation when specifying explicit line numbers - [Kevin Guerra](https://github.com/kevingnet) + +### Stats +* 37 commits +* 10 closed tickets & PRs +* Days since last release: 27 + ## 28-August-2021 - 6.38.0 The PMD team is pleased to announce PMD 6.38.0. diff --git a/pmd-javascript/src/test/java/net/sourceforge/pmd/lang/ecmascript/EcmasccriptLanguageModuleTest.java b/pmd-javascript/src/test/java/net/sourceforge/pmd/lang/ecmascript/EcmasccriptLanguageModuleTest.java new file mode 100644 index 0000000000..60d698ebe5 --- /dev/null +++ b/pmd-javascript/src/test/java/net/sourceforge/pmd/lang/ecmascript/EcmasccriptLanguageModuleTest.java @@ -0,0 +1,46 @@ +/* + * BSD-style license; for more info see http://pmd.sourceforge.net/license.html + */ + +package net.sourceforge.pmd.lang.ecmascript; + +import org.junit.Assert; +import org.junit.Test; + +import net.sourceforge.pmd.Rule; +import net.sourceforge.pmd.RuleContext; +import net.sourceforge.pmd.RuleViolation; +import net.sourceforge.pmd.lang.LanguageRegistry; +import net.sourceforge.pmd.lang.LanguageVersion; +import net.sourceforge.pmd.lang.LanguageVersionHandler; +import net.sourceforge.pmd.lang.ecmascript.ast.ASTAstRoot; +import net.sourceforge.pmd.lang.ecmascript.ast.JsParsingHelper; +import net.sourceforge.pmd.lang.ecmascript.rule.AbstractEcmascriptRule; +import net.sourceforge.pmd.lang.rule.RuleViolationFactory; + +public class EcmasccriptLanguageModuleTest { + private Rule rule = new AbstractEcmascriptRule() { }; + private ASTAstRoot node = JsParsingHelper.DEFAULT.parse("function a() {}"); + private LanguageVersion js = LanguageRegistry.getLanguage(EcmascriptLanguageModule.NAME).getDefaultVersion(); + private LanguageVersionHandler languageVersionHandler = js.getLanguageVersionHandler(); + private RuleViolationFactory ruleViolationFactory = languageVersionHandler.getRuleViolationFactory(); + + @Test + public void canCreateRuleViolation() { + RuleContext context = new RuleContext(); + ruleViolationFactory.addViolation(context, rule, node, "the message", new Object[0]); + Assert.assertEquals(1, context.getReport().getViolations().size()); + RuleViolation ruleViolation = context.getReport().getViolations().get(0); + Assert.assertEquals(1, ruleViolation.getBeginLine()); + } + + @Test + public void canCreateRuleViolationWithLineNumbers() { + RuleContext context = new RuleContext(); + ruleViolationFactory.addViolation(context, rule, node, "the message", 5, 7, new Object[0]); + Assert.assertEquals(1, context.getReport().getViolations().size()); + RuleViolation ruleViolation = context.getReport().getViolations().get(0); + Assert.assertEquals(5, ruleViolation.getBeginLine()); + Assert.assertEquals(7, ruleViolation.getEndLine()); + } +} diff --git a/pmd-plsql/etc/grammar/PLSQL.jjt b/pmd-plsql/etc/grammar/PLSQL.jjt index 762ad31b63..9b36d5eb48 100644 --- a/pmd-plsql/etc/grammar/PLSQL.jjt +++ b/pmd-plsql/etc/grammar/PLSQL.jjt @@ -2000,10 +2000,13 @@ ASTIntoClause IntoClause() : { return jjtThis; } } +// This might also be a associative array dereference... +// see https://github.com/pmd/pmd/issues/3515 ASTVariableName VariableName() : -{ ASTID id; StringBuilder name = new StringBuilder(); } +{ ASTID id; ASTLiteral lit; StringBuilder name = new StringBuilder(); } { id = ID() { name.append(id.getImage()); } + [ "(" lit = Literal() ")" { name.append('(').append(lit.getImage()).append(')'); } ] [ "." id = ID() { name.append('.').append(id.getImage()); } ] [ "." id = ID() { name.append('.').append(id.getImage()); } ] { diff --git a/pmd-plsql/src/test/java/net/sourceforge/pmd/lang/plsql/ast/PlsqlTreeDumpTest.java b/pmd-plsql/src/test/java/net/sourceforge/pmd/lang/plsql/ast/PlsqlTreeDumpTest.java index 089c16f76a..3a4c1cc8f8 100644 --- a/pmd-plsql/src/test/java/net/sourceforge/pmd/lang/plsql/ast/PlsqlTreeDumpTest.java +++ b/pmd-plsql/src/test/java/net/sourceforge/pmd/lang/plsql/ast/PlsqlTreeDumpTest.java @@ -36,4 +36,9 @@ public class PlsqlTreeDumpTest extends BaseTreeDumpTest { public void parseOpenForStatement() { doTest("OpenForStatement"); } + + @Test + public void parseSelectIntoAssociativeArrayType() { + doTest("SelectIntoArray"); + } } diff --git a/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/SelectIntoArray.pls b/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/SelectIntoArray.pls new file mode 100644 index 0000000000..b8698f8422 --- /dev/null +++ b/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/SelectIntoArray.pls @@ -0,0 +1,22 @@ +-- +-- See https://github.com/pmd/pmd/issues/3515 +-- + +CREATE OR REPLACE PROCEDURE EXAMPLE_PROCEDURE IS + -- + TYPE example_data_rt IS RECORD( + field_one PLS_INTEGER, + field_two PLS_INTEGER, + field_three PLS_INTEGER); + -- + TYPE example_data_aat IS TABLE OF example_data_rt INDEX BY BINARY_INTEGER; + -- + l_example_data example_data_aat; + -- +BEGIN + -- + SELECT 1 field_value_one, 2 field_value_two, 3 field_value_three + INTO l_example_data(1).field_one,l_example_data(1).field_two,l_example_data(1).field_three + FROM DUAL; + -- +END EXAMPLE_PROCEDURE; diff --git a/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/SelectIntoArray.txt b/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/SelectIntoArray.txt new file mode 100644 index 0000000000..2709539e5e --- /dev/null +++ b/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/SelectIntoArray.txt @@ -0,0 +1,103 @@ ++- Input[@CanonicalImage = null, @ExcludedLinesCount = 0, @ExcludedRangesCount = 0, @Sourcecode = "-- +-- See https://github.com/pmd/pmd/issues/3515 +-- + +CREATE OR REPLACE PROCEDURE EXAMPLE_PROCEDURE IS + -- + TYPE example_data_rt IS RECORD( + field_one PLS_INTEGER, + field_two PLS_INTEGER, + field_three PLS_INTEGER); + -- + TYPE example_data_aat IS TABLE OF example_data_rt INDEX BY BINARY_INTEGER; + -- + l_example_data example_data_aat; + -- +BEGIN + -- + SELECT 1 field_value_one, 2 field_value_two, 3 field_value_three + INTO l_example_data(1).field_one,l_example_data(1).field_two,l_example_data(1).field_three + FROM DUAL; + -- +END EXAMPLE_PROCEDURE; +"] + +- Global[@CanonicalImage = null] + +- ProgramUnit[@CanonicalImage = null, @MethodName = "EXAMPLE_PROCEDURE", @Name = "EXAMPLE_PROCEDURE", @ObjectName = null] + +- MethodDeclarator[@CanonicalImage = "EXAMPLE_PROCEDURE", @Image = "EXAMPLE_PROCEDURE", @ParameterCount = 1] + | +- ObjectNameDeclaration[@CanonicalImage = "EXAMPLE_PROCEDURE", @Image = "EXAMPLE_PROCEDURE"] + | +- ID[@CanonicalImage = "EXAMPLE_PROCEDURE", @Image = "EXAMPLE_PROCEDURE"] + +- DeclarativeSection[@CanonicalImage = null] + | +- DeclarativeUnit[@CanonicalImage = null] + | | +- SubTypeDefinition[@CanonicalImage = "EXAMPLE_DATA_RT", @Image = "example_data_rt"] + | | +- QualifiedID[@CanonicalImage = "EXAMPLE_DATA_RT", @Image = "example_data_rt"] + | | +- FieldDeclaration[@CanonicalImage = "FIELD_ONE", @Image = "field_one"] + | | | +- ID[@CanonicalImage = "FIELD_ONE", @Image = "field_one"] + | | | +- Datatype[@CanonicalImage = "PLS_INTEGER", @Image = "PLS_INTEGER", @TypeImage = "PLS_INTEGER"] + | | | +- ScalarDataTypeName[@CanonicalImage = "PLS_INTEGER", @Image = "PLS_INTEGER"] + | | +- FieldDeclaration[@CanonicalImage = "FIELD_TWO", @Image = "field_two"] + | | | +- ID[@CanonicalImage = "FIELD_TWO", @Image = "field_two"] + | | | +- Datatype[@CanonicalImage = "PLS_INTEGER", @Image = "PLS_INTEGER", @TypeImage = "PLS_INTEGER"] + | | | +- ScalarDataTypeName[@CanonicalImage = "PLS_INTEGER", @Image = "PLS_INTEGER"] + | | +- FieldDeclaration[@CanonicalImage = "FIELD_THREE", @Image = "field_three"] + | | +- ID[@CanonicalImage = "FIELD_THREE", @Image = "field_three"] + | | +- Datatype[@CanonicalImage = "PLS_INTEGER", @Image = "PLS_INTEGER", @TypeImage = "PLS_INTEGER"] + | | +- ScalarDataTypeName[@CanonicalImage = "PLS_INTEGER", @Image = "PLS_INTEGER"] + | +- DeclarativeUnit[@CanonicalImage = null] + | | +- SubTypeDefinition[@CanonicalImage = "EXAMPLE_DATA_AAT", @Image = "example_data_aat"] + | | +- QualifiedID[@CanonicalImage = "EXAMPLE_DATA_AAT", @Image = "example_data_aat"] + | | +- Datatype[@CanonicalImage = "EXAMPLE_DATA_RT", @Image = "example_data_rt", @TypeImage = "example_data_rt"] + | | | +- QualifiedName[@CanonicalImage = "EXAMPLE_DATA_RT", @Image = "example_data_rt"] + | | | +- UnqualifiedID[@CanonicalImage = "EXAMPLE_DATA_RT", @Image = "example_data_rt"] + | | +- Datatype[@CanonicalImage = "BINARY_INTEGER", @Image = "BINARY_INTEGER", @TypeImage = "BINARY_INTEGER"] + | | +- ScalarDataTypeName[@CanonicalImage = "BINARY_INTEGER", @Image = "BINARY_INTEGER"] + | +- DeclarativeUnit[@CanonicalImage = null] + | +- VariableOrConstantDeclaration[@CanonicalImage = null] + | +- VariableOrConstantDeclarator[@CanonicalImage = "L_EXAMPLE_DATA EXAMPLE_DATA_AAT", @Image = "l_example_data example_data_aat"] + | +- VariableOrConstantDeclaratorId[@Array = false, @ArrayDepth = 0, @CanonicalImage = "L_EXAMPLE_DATA", @Image = "l_example_data"] + | | +- ID[@CanonicalImage = "L_EXAMPLE_DATA", @Image = "l_example_data"] + | +- Datatype[@CanonicalImage = "EXAMPLE_DATA_AAT", @Image = "example_data_aat", @TypeImage = "example_data_aat"] + | +- QualifiedName[@CanonicalImage = "EXAMPLE_DATA_AAT", @Image = "example_data_aat"] + | +- UnqualifiedID[@CanonicalImage = "EXAMPLE_DATA_AAT", @Image = "example_data_aat"] + +- Statement[@CanonicalImage = null] + | +- UnlabelledStatement[@CanonicalImage = null] + | +- SelectIntoStatement[@All = false, @CanonicalImage = null, @Distinct = false, @Unique = false] + | +- SelectList[@CanonicalImage = null] + | | +- SqlExpression[@CanonicalImage = "1", @Image = "1"] + | | | +- PrimaryPrefix[@CanonicalImage = "1", @Image = "1", @SelfModifier = false] + | | | +- Literal[@CanonicalImage = "1", @Image = "1"] + | | | +- NumericLiteral[@CanonicalImage = "1", @Image = "1"] + | | +- ColumnAlias[@CanonicalImage = "FIELD_VALUE_ONE", @Image = "field_value_one"] + | | | +- ID[@CanonicalImage = "FIELD_VALUE_ONE", @Image = "field_value_one"] + | | +- SqlExpression[@CanonicalImage = "2", @Image = "2"] + | | | +- PrimaryPrefix[@CanonicalImage = "2", @Image = "2", @SelfModifier = false] + | | | +- Literal[@CanonicalImage = "2", @Image = "2"] + | | | +- NumericLiteral[@CanonicalImage = "2", @Image = "2"] + | | +- ColumnAlias[@CanonicalImage = "FIELD_VALUE_TWO", @Image = "field_value_two"] + | | | +- ID[@CanonicalImage = "FIELD_VALUE_TWO", @Image = "field_value_two"] + | | +- SqlExpression[@CanonicalImage = "3", @Image = "3"] + | | | +- PrimaryPrefix[@CanonicalImage = "3", @Image = "3", @SelfModifier = false] + | | | +- Literal[@CanonicalImage = "3", @Image = "3"] + | | | +- NumericLiteral[@CanonicalImage = "3", @Image = "3"] + | | +- ColumnAlias[@CanonicalImage = "FIELD_VALUE_THREE", @Image = "field_value_three"] + | | +- ID[@CanonicalImage = "FIELD_VALUE_THREE", @Image = "field_value_three"] + | +- IntoClause[@CanonicalImage = null] + | | +- VariableName[@CanonicalImage = "L_EXAMPLE_DATA(1).FIELD_ONE", @Image = "l_example_data(1).field_one"] + | | | +- ID[@CanonicalImage = "L_EXAMPLE_DATA", @Image = "l_example_data"] + | | | +- Literal[@CanonicalImage = "1", @Image = "1"] + | | | | +- NumericLiteral[@CanonicalImage = "1", @Image = "1"] + | | | +- ID[@CanonicalImage = "FIELD_ONE", @Image = "field_one"] + | | +- VariableName[@CanonicalImage = "L_EXAMPLE_DATA(1).FIELD_TWO", @Image = "l_example_data(1).field_two"] + | | | +- ID[@CanonicalImage = "L_EXAMPLE_DATA", @Image = "l_example_data"] + | | | +- Literal[@CanonicalImage = "1", @Image = "1"] + | | | | +- NumericLiteral[@CanonicalImage = "1", @Image = "1"] + | | | +- ID[@CanonicalImage = "FIELD_TWO", @Image = "field_two"] + | | +- VariableName[@CanonicalImage = "L_EXAMPLE_DATA(1).FIELD_THREE", @Image = "l_example_data(1).field_three"] + | | +- ID[@CanonicalImage = "L_EXAMPLE_DATA", @Image = "l_example_data"] + | | +- Literal[@CanonicalImage = "1", @Image = "1"] + | | | +- NumericLiteral[@CanonicalImage = "1", @Image = "1"] + | | +- ID[@CanonicalImage = "FIELD_THREE", @Image = "field_three"] + | +- FromClause[@CanonicalImage = null] + | +- TableReference[@CanonicalImage = null] + | +- TableName[@CanonicalImage = "DUAL", @Image = "DUAL"] + | +- ID[@CanonicalImage = "DUAL", @Image = "DUAL"] + +- ID[@CanonicalImage = "EXAMPLE_PROCEDURE", @Image = "EXAMPLE_PROCEDURE"] diff --git a/pom.xml b/pom.xml index 6f5b89d5d9..5dd7f00910 100644 --- a/pom.xml +++ b/pom.xml @@ -76,7 +76,7 @@ - 2021-08-28T15:27:18Z + 2021-09-25T11:46:09Z 8