diff --git a/.all-contributorsrc b/.all-contributorsrc index 7d94f872d8..5ee35af736 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -6566,6 +6566,15 @@ "contributions": [ "bug" ] + }, + { + "login": "btjiong", + "name": "Bailey Tjiong", + "avatar_url": "https://avatars.githubusercontent.com/u/15816011?v=4", + "profile": "https://github.com/btjiong", + "contributions": [ + "code" + ] } ], "contributorsPerLine": 7, diff --git a/.ci/files/project-list.xml b/.ci/files/project-list.xml index 1b43140068..a115dc9900 100644 --- a/.ci/files/project-list.xml +++ b/.ci/files/project-list.xml @@ -40,10 +40,6 @@ mvn dependency:build-classpath -DincludeScope=test -Dmdep.outputFile=classpath.t .*/build/generated-sources/.* classpath.txt ]]> diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties index 8c79a83ae4..db95c131dd 100644 --- a/.mvn/wrapper/maven-wrapper.properties +++ b/.mvn/wrapper/maven-wrapper.properties @@ -14,5 +14,5 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.4/apache-maven-3.8.4-bin.zip +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.5/apache-maven-3.8.5-bin.zip wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar diff --git a/Gemfile.lock b/Gemfile.lock index 359c937c19..3c5a1abe22 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -12,7 +12,7 @@ GEM concurrent-ruby (1.1.9) cork (0.3.0) colored2 (~> 3.1) - danger (8.4.3) + danger (8.4.5) claide (~> 1.0) claide-plugins (>= 0.9.2) colored2 (~> 3.1) @@ -26,7 +26,7 @@ GEM octokit (~> 4.7) terminal-table (>= 1, < 4) differ (0.1.2) - et-orbi (1.2.6) + et-orbi (1.2.7) tzinfo faraday (1.10.0) faraday-em_http (~> 1.0) @@ -62,7 +62,7 @@ GEM rexml kramdown-parser-gfm (1.1.0) kramdown (~> 2.0) - liquid (5.1.0) + liquid (5.2.0) logger-colors (1.0.0) mini_portile2 (2.8.0) multipart-post (2.1.1) diff --git a/docs/Gemfile.lock b/docs/Gemfile.lock index 327bd7ca7d..48cf85a1d9 100644 --- a/docs/Gemfile.lock +++ b/docs/Gemfile.lock @@ -1,7 +1,7 @@ GEM remote: https://rubygems.org/ specs: - activesupport (6.0.4.6) + activesupport (6.0.4.7) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) @@ -14,8 +14,7 @@ GEM execjs coffee-script-source (1.11.1) colorator (1.1.0) - commonmarker (0.17.13) - ruby-enum (~> 0.5) + commonmarker (0.23.4) concurrent-ruby (1.1.9) dnsruby (1.61.9) simpleidn (~> 0.1) @@ -52,12 +51,12 @@ GEM ffi (1.15.5) forwardable-extended (2.6.0) gemoji (3.0.1) - github-pages (223) + github-pages (225) github-pages-health-check (= 1.17.9) jekyll (= 3.9.0) jekyll-avatar (= 0.7.0) jekyll-coffeescript (= 1.1.1) - jekyll-commonmark-ghpages (= 0.1.6) + jekyll-commonmark-ghpages (= 0.2.0) jekyll-default-layout (= 0.1.4) jekyll-feed (= 0.15.1) jekyll-gist (= 1.5.0) @@ -71,7 +70,7 @@ GEM jekyll-relative-links (= 0.6.1) jekyll-remote-theme (= 0.4.3) jekyll-sass-converter (= 1.5.2) - jekyll-seo-tag (= 2.7.1) + jekyll-seo-tag (= 2.8.0) jekyll-sitemap (= 1.4.0) jekyll-swiss (= 1.0.0) jekyll-theme-architect (= 0.2.0) @@ -127,12 +126,12 @@ GEM jekyll-coffeescript (1.1.1) coffee-script (~> 2.2) coffee-script-source (~> 1.11.1) - jekyll-commonmark (1.3.1) - commonmarker (~> 0.14) - jekyll (>= 3.7, < 5.0) - jekyll-commonmark-ghpages (0.1.6) - commonmarker (~> 0.17.6) - jekyll-commonmark (~> 1.2) + jekyll-commonmark (1.4.0) + commonmarker (~> 0.22) + jekyll-commonmark-ghpages (0.2.0) + commonmarker (~> 0.23.4) + jekyll (~> 3.9.0) + jekyll-commonmark (~> 1.4.0) rouge (>= 2.0, < 4.0) jekyll-default-layout (0.1.4) jekyll (~> 3.0) @@ -164,7 +163,7 @@ GEM rubyzip (>= 1.3.0, < 3.0) jekyll-sass-converter (1.5.2) sass (~> 3.4) - jekyll-seo-tag (2.7.1) + jekyll-seo-tag (2.8.0) jekyll (>= 3.8, < 5.0) jekyll-sitemap (1.4.0) jekyll (>= 3.7, < 5.0) @@ -248,8 +247,6 @@ GEM ffi (~> 1.0) rexml (3.2.5) rouge (3.26.0) - ruby-enum (0.9.0) - i18n ruby2_keywords (0.0.5) rubyzip (2.3.2) safe_yaml (1.0.5) diff --git a/docs/_includes/footer.html b/docs/_includes/footer.html index 6879e1fcb6..e8e3c871f4 100755 --- a/docs/_includes/footer.html +++ b/docs/_includes/footer.html @@ -1,12 +1,30 @@ diff --git a/docs/_includes/header.html b/docs/_includes/header.html new file mode 100644 index 0000000000..3610392812 --- /dev/null +++ b/docs/_includes/header.html @@ -0,0 +1,23 @@ +
+
+
+ + » {{page.title}} {% if site.github_editme_path %} {% assign + editmepath = page.path %} {% if page.editmepath %} {% assign + editmepath = page.editmepath %} {% endif %}{% unless page.editmepath + == false %} + Edit on GitHub + {% endunless %} {% endif %} +
+
+ +
+
diff --git a/docs/_includes/toc.html b/docs/_includes/toc.html deleted file mode 100644 index 48701ec3fc..0000000000 --- a/docs/_includes/toc.html +++ /dev/null @@ -1,5 +0,0 @@ -{% comment %} -Note: The content of the div-element is filled by javascript. See customscripts.js. -{% endcomment %} - -
diff --git a/docs/_layouts/default.html b/docs/_layouts/default.html index 95137215ae..5e0065208f 100644 --- a/docs/_layouts/default.html +++ b/docs/_layouts/default.html @@ -36,7 +36,7 @@ {% unless page.toc == false %}
- {% include toc.html %} +
{% endunless %} diff --git a/docs/_layouts/page.html b/docs/_layouts/page.html index 2139dae1b6..5acf2a12af 100644 --- a/docs/_layouts/page.html +++ b/docs/_layouts/page.html @@ -2,31 +2,19 @@ layout: default --- +{% include header.html %} +

{{ page.title }}

-
+
{% if page.summary %}
{{page.summary}}
{% endif %} -
- - {% if site.github_editme_path %} - - {% assign editmepath = page.path %} - {% if page.editmepath %} - {% assign editmepath = page.editmepath %} - {% endif %} - {% unless page.editmepath == false %} - Edit me - {% endunless %} - - {% endif %} - {{content}}
@@ -43,6 +31,5 @@ layout: default
-{{site.data.alerts.hr_shaded}} {% include footer.html %} diff --git a/docs/css/customstyles.css b/docs/css/customstyles.css index f66ed349c9..1a6002a6e4 100644 --- a/docs/css/customstyles.css +++ b/docs/css/customstyles.css @@ -1,5 +1,5 @@ body { - font-size:15px; + font-size: 15px; } @media (max-width: 1349px) { /* Small screen, inline TOC*/ @@ -11,7 +11,7 @@ body { display: none; } - div#toc{ + div#toc { margin-top: 15px; margin-left: 0px; margin-right: 0px; @@ -25,10 +25,12 @@ body { @media (min-width: 1350px) { /* Medium screens, keep sticky TOC but remove justify-content*/ - div#toc{ + div#toc { margin-top: 60px; margin-left: -15px; margin-right: 15px; + height: 80%; + overflow: auto; } .container { margin-left: 15px; @@ -45,10 +47,12 @@ body { } @media (min-width: 1600px) { /* Sticky TOC functionality */ - div#toc{ + div#toc { margin-top: 60px; margin-left: -15px; margin-right: 15px; + height: 80%; + overflow: auto; } .container { margin-left: 15px; @@ -65,7 +69,6 @@ body { } } - .bs-callout { padding: 20px; margin: 20px 0; @@ -83,7 +86,7 @@ body { .bs-callout code { border-radius: 3px; } -.bs-callout+.bs-callout { +.bs-callout + .bs-callout { margin-top: -5px; } .bs-callout-default { @@ -123,17 +126,22 @@ body { color: #5bc0de; } +.gi-2x { + font-size: 2em; +} +.gi-3x { + font-size: 3em; +} +.gi-4x { + font-size: 4em; +} +.gi-5x { + font-size: 5em; +} -.gi-2x{font-size: 2em;} -.gi-3x{font-size: 3em;} -.gi-4x{font-size: 4em;} -.gi-5x{font-size: 5em;} - - - - - -.breadcrumb > .active {color: #777 !important;} +.breadcrumb > .active { + color: #777 !important; +} /* make room for the nav bar */ h1[id], @@ -142,12 +150,14 @@ h3[id], h4[id], h5[id], h6[id], -dt[id]{ -padding-top: 20px; -margin-top: 0px +dt[id] { + padding-top: 20px; + margin-top: 0px; } -body h1 {margin-top:40px;} +body h1 { + margin-top: 40px; +} .post-content img { margin: 12px 0px 3px 0px; @@ -157,22 +167,23 @@ body h1 {margin-top:40px;} max-height: 100%; } -.post-content ol li, .post-content ul li { +.post-content ol li, +.post-content ul li { margin: 10px 0px; } .pageSummary { - font-size:13px; - display:block; - margin-bottom:15px; - padding-left:20px; + font-size: 13px; + display: block; + margin-bottom: 15px; + padding-left: 20px; } .post-summary { - margin-bottom:12px; + margin-bottom: 12px; } -.bs-example{ +.bs-example { margin: 20px; } @@ -230,19 +241,18 @@ table > tbody > tr:nth-of-type(odd) { background-color: #f9f9f9; } -table col[class*="col-"] { +table col[class*='col-'] { position: static; display: table-column; float: none; } -table td[class*="col-"], -table th[class*="col-"] { +table td[class*='col-'], +table th[class*='col-'] { position: static; display: table-cell; float: none; } - table td:first-child { width: 150px; /*font-weight:bold;*/ @@ -256,20 +266,28 @@ table tr td { hyphens: auto; } - p.external a { - text-align:right; - font-size:12px; + text-align: right; + font-size: 12px; color: #0088cc; - display:inline; + display: inline; } #definition-box-container div a.active { font-weight: bold; } -p.post-meta {font-size: 80%; color: #777;} +p.post-meta { + font-size: 80%; + color: #777; +} -.entry-date{font-size:14px;font-size:0.875rem;line-height:1.71429;margin-bottom:0;text-transform:uppercase;} +.entry-date { + font-size: 14px; + font-size: 0.875rem; + line-height: 1.71429; + margin-bottom: 0; + text-transform: uppercase; +} /* search area */ ul#results-container { @@ -279,12 +297,12 @@ ul#results-container { position: absolute; top: 50px; /* if you change anything about the nav, you'll prob. need to reset the top and left values here.*/ z-index: -1; + width: 223px; border-left: 1px solid #dedede; box-shadow: 2px 3px 2px #dedede; padding: 0px; } - ul#results-container a { background-color: transparent; } @@ -321,44 +339,41 @@ div#toc ul { } div#toc ul li ul { - padding-left:8px; - + padding-left: 8px; } div#toc ul li ul li::before { - content: "– "; + content: '– '; } -div#toc >ul::before { - content: "Table of Contents"; +div#toc > ul::before { + content: 'Table of Contents'; font-weight: 500; color: #555; - text-align:center; - margin-left:auto; - margin-right:auto; - width:70px; - padding-top:20px; - padding-bottom:20px; - padding-left:10px; + text-align: center; + margin-left: auto; + margin-right: auto; + width: 70px; + padding-top: 20px; + padding-bottom: 20px; + padding-left: 10px; } li.dropdownActive a { font-weight: bold; } - .post-content a.fa-rss { color: orange; } - .navbar-inverse .navbar-nav > li > a { background-color: transparent; - margin-top:10px; + margin-top: 10px; } .post-content .rssfeedLink { - color: #248EC2; + color: #248ec2; } footer { @@ -370,25 +385,28 @@ footer { font-size: 12px; } -a.accordion-toggle, a.accordion-collapsed { +a.accordion-toggle, +a.accordion-collapsed { font-size: 14px; text-decoration: none; } /* navgoco sidebar styles (customized) */ -.nav, .nav ul, .nav li { +.nav, +.nav ul, +.nav li { list-style: none; } .nav ul { padding: 0; /*margin: 0 0 0 18px;*/ - margin:0px; + margin: 0px; } .nav { /* padding: 4px;*/ - padding:0px; + padding: 0px; margin: 0px; } @@ -416,7 +434,6 @@ a.accordion-toggle, a.accordion-collapsed { font-weight: bolder; } - .nav li > a > span:after { content: '\25be'; } @@ -424,13 +441,14 @@ a.accordion-toggle, a.accordion-collapsed { content: '\25b4'; } -.nav a:hover, .nav li.active > a { - background-color: #8D8D8D; +.nav a:hover, +.nav li.active > a { + background-color: #8d8d8d; color: #f5f5f5; } -.nav > li.active > a { -background-color: #347DBE; +.nav > li.active > a { + background-color: #347dbe; } .nav li a { @@ -448,44 +466,47 @@ background-color: #347DBE; ul#mysidebar { display: block; - border-radius:0px; + border-radius: 0px; } .nav ul li ul li a { - padding-left:40px; + padding-left: 40px; } .nav li.thirdlevel > a { - color: #248EC2; - font-weight:bold; - padding-left:20px; + color: #248ec2; + font-weight: bold; + padding-left: 20px; background-color: whitesmoke !important; } - .nav ul li a { - background-color: #FAFAFA; + background-color: #fafafa; } .nav li a { - padding-right:10px; + padding-right: 10px; } .nav li a:hover { - background-color: #8D8D8D; + background-color: #8d8d8d; } .nav ul li a { - border-top:1px solid whitesmoke; - padding-left:10px; + border-top: 1px solid whitesmoke; + padding-left: 10px; } /* end sidebar */ -.navbar-inverse .navbar-nav > .active > a, .navbar-inverse .navbar-nav > .active > a:hover, .navbar-inverse .navbar-nav > .active > a:focus { - border-radius:5px; +.navbar-inverse .navbar-nav > .active > a, +.navbar-inverse .navbar-nav > .active > a:hover, +.navbar-inverse .navbar-nav > .active > a:focus { + border-radius: 5px; } -.navbar-inverse .navbar-nav>.open>a, .navbar-inverse .navbar-nav>.open>a:focus, .navbar-inverse .navbar-nav>.open>a:hover { +.navbar-inverse .navbar-nav > .open > a, +.navbar-inverse .navbar-nav > .open > a:focus, +.navbar-inverse .navbar-nav > .open > a:hover { border-radius: 5px; } @@ -504,23 +525,21 @@ span.projectTitle { max-width: 250px; border-radius: 5px; margin-top: 50px; - font-style:italic; - font-size:12px; + font-style: italic; + font-size: 12px; } img.screenshotSmall { max-width: 300px; } - dl dt p { - margin-left:20px; + margin-left: 20px; } - dl dd { - margin-top:10px; - margin-bottom:10px; + margin-top: 10px; + margin-bottom: 10px; } dl.dl-horizontal dd { @@ -528,14 +547,12 @@ dl.dl-horizontal dd { } figcaption { - - padding-bottom:12px; - padding-top:6px; + padding-bottom: 12px; + padding-top: 6px; max-width: 90%; - margin-bottom:20px; + margin-bottom: 20px; font-style: italic; color: gray; - } .testing { @@ -546,6 +563,9 @@ figcaption { color: red; } +table.dataTable thead { + background-color: #444; +} table td { hyphens: auto; @@ -559,10 +579,14 @@ table tr.info { background-color: #d9edf7 !important; } -section table tr.warning, table tr.testing, table tr.testing > td.sorting_1 { +section table tr.warning, +table tr.testing, +table tr.testing > td.sorting_1 { background-color: #fcf8e3 !important; } -section table tr.danger, table tr.preference, table tr.preference > td.sorting_1 { +section table tr.danger, +table tr.preference, +table tr.preference > td.sorting_1 { background-color: #f2dede !important; } @@ -575,58 +599,89 @@ table.profile thead tr th { } table.request thead tr th { - background-color: #ED1951; + background-color: #ed1951; } .audienceLabel { margin: 10px; float: right; - border:1px solid #dedede; - padding:7px; + border: 1px solid #dedede; + padding: 7px; } .prefaceAudienceLabel { color: gray; text-align: center; - margin:5px; + margin: 5px; } span.myLabel { - padding-left:10px; - padding-right:10px; + padding-left: 10px; + padding-right: 10px; } button.cursorNorm { cursor: default; } -a.dropdown-toggle, .navbar-inverse .navbar-nav > li > a { +a.dropdown-toggle, +.navbar-inverse .navbar-nav > li > a { margin-left: 10px; } hr.faded { border: 0; height: 1px; - background-image: -webkit-linear-gradient(left, rgba(0,0,0,0), rgba(0,0,0,0.75), rgba(0,0,0,0)); - background-image: -moz-linear-gradient(left, rgba(0,0,0,0), rgba(0,0,0,0.75), rgba(0,0,0,0)); - background-image: -ms-linear-gradient(left, rgba(0,0,0,0), rgba(0,0,0,0.75), rgba(0,0,0,0)); - background-image: -o-linear-gradient(left, rgba(0,0,0,0), rgba(0,0,0,0.75), rgba(0,0,0,0)); + background-image: -webkit-linear-gradient( + left, + rgba(0, 0, 0, 0), + rgba(0, 0, 0, 0.75), + rgba(0, 0, 0, 0) + ); + background-image: -moz-linear-gradient( + left, + rgba(0, 0, 0, 0), + rgba(0, 0, 0, 0.75), + rgba(0, 0, 0, 0) + ); + background-image: -ms-linear-gradient( + left, + rgba(0, 0, 0, 0), + rgba(0, 0, 0, 0.75), + rgba(0, 0, 0, 0) + ); + background-image: -o-linear-gradient( + left, + rgba(0, 0, 0, 0), + rgba(0, 0, 0, 0.75), + rgba(0, 0, 0, 0) + ); } hr.shaded { height: 12px; border: 0; - box-shadow: inset 0 6px 6px -6px rgba(0,0,0,0.5); + box-shadow: inset 0 6px 6px -6px rgba(0, 0, 0, 0.5); margin-top: 70px; background: white; width: 100%; margin-bottom: 10px; } -.fa-6x{font-size:900%;} -.fa-7x{font-size:1100%;} -.fa-8x{font-size:1300%;} -.fa-9x{font-size:1500%;} -.fa-10x{font-size:1700%;} +.fa-6x { + font-size: 900%; +} +.fa-7x { + font-size: 1100%; +} +.fa-8x { + font-size: 1300%; +} +.fa-9x { + font-size: 1500%; +} +.fa-10x { + font-size: 1700%; +} i.border { padding: 10px 20px; @@ -634,44 +689,60 @@ i.border { } a[data-toggle] { - color: #248EC2; + color: #248ec2; } .summary { - font-size:120%; + font-size: 120%; color: #808080; - margin:20px 0px 20px 0px; - border-left: 5px solid #ED1951; + margin: 20px 0px 20px 0px; + border-left: 5px solid #ed1951; padding-left: 10px; - } .summary:before { - content: "Summary: "; + content: 'Summary: '; font-weight: bold; } - a.fa.fa-envelope-o.mailto { font-weight: 600; } -h3 {color: #ED1951; font-weight:normal; font-size:130%;} -h4 {color: #808080; font-weight:normal; font-size:120%; font-style:italic;} +h3 { + color: #ed1951; + font-weight: normal; + font-size: 130%; +} +h4 { + color: #808080; + font-weight: normal; + font-size: 120%; + font-style: italic; +} -.alert, .callout { +.alert, +.callout { overflow: hidden; } -.nav-tabs > li.active > a, .nav-tabs > li.active > a:hover, .nav-tabs > li.active > a:focus { +.nav-tabs > li.active > a, +.nav-tabs > li.active > a:hover, +.nav-tabs > li.active > a:focus { background-color: #248ec2; color: white; } -ol li ol li {list-style-type: lower-alpha;} -ol li ul li {list-style-type: disc;} +ol li ol li { + list-style-type: lower-alpha; +} +ol li ul li { + list-style-type: disc; +} -li img {clear:both; } +li img { + clear: both; +} div#toc ul li ul li { list-style-type: none; @@ -680,10 +751,12 @@ div#toc ul li ul li { .tab-content { padding: 15px; - background-color: #FAFAFA; + background-color: #fafafa; } -span.tagTitle {font-weight: 500;} +span.tagTitle { + font-weight: 500; +} li.activeSeries { font-weight: bold; @@ -692,14 +765,15 @@ li.activeSeries { .seriesContext .dropdown-menu li.active { font-weight: bold; margin-left: 43px; - font-size:18px; + font-size: 18px; } .alert-warning { color: #444; } -div.alert code, h2 code { +div.alert code, +h2 code { background-color: transparent !important; } /* without this, the links in these notes aren't visible.*/ @@ -707,7 +781,9 @@ div.alert code, h2 code { text-decoration: underline; } -div.tags {padding: 10px 5px;} +div.tags { + padding: 10px 5px; +} .tabLabel { font-weight: normal; @@ -715,8 +791,8 @@ div.tags {padding: 10px 5px;} hr { background: #999; - margin: 30px 0px; - width: 90%; + margin: 10px 0px; + width: 100%; margin-left: auto; margin-right: auto; } @@ -725,21 +801,22 @@ button.cursorNorm { cursor: pointer; } -h2 { - font-size:24px; - line-height:29px; +h2 { + font-size: 24px; + line-height: 29px; } span.otherProgrammingLanguages { font-style: normal; } -a[data-toggle="tooltip"] { +a[data-toggle='tooltip'] { color: #649345; font-style: italic; cursor: default; } -.seriesNext, .seriesContext { +.seriesNext, +.seriesContext { margin-top: 15px; margin-bottom: 15px; } @@ -771,20 +848,21 @@ ol.series li { font-family: courier; color: silver; color: #444; - display:block; + display: block; } /* not sure if using this ...*/ -.navbar-inverse .navbar-collapse, .navbar-inverse .navbar-form { +.navbar-inverse .navbar-collapse, +.navbar-inverse .navbar-form { border-color: #248ec2 !important; } #mysidebar .nav ul { - background-color: #FAFAFA; + background-color: #fafafa; } .nav ul.series li { list-style: decimal; - font-size:12px; + font-size: 12px; } .nav ul.series li a:hover { @@ -795,7 +873,7 @@ ol.series li { } .nav ul.series { - background-color: #FAFAFA; + background-color: #fafafa; } /* @@ -804,9 +882,13 @@ a.dropdown-toggle.otherProgLangs { } */ -span.muted {color: #666;} +span.muted { + color: #666; +} -table code {background-color: transparent;} +table code { + background-color: transparent; +} .highlight .err { color: #a61717; @@ -818,12 +900,13 @@ table p { margin-bottom: 12px; } -pre, table code { - white-space: pre-wrap; /* css-3 */ - white-space: -moz-pre-wrap; /* Mozilla, since 1999 */ - white-space: -pre-wrap; /* Opera 4-6 */ - white-space: -o-pre-wrap; /* Opera 7 */ - word-wrap: break-word; /* Internet Explorer 5.5+ */ +pre, +table code { + white-space: pre-wrap; /* css-3 */ + white-space: -moz-pre-wrap; /* Mozilla, since 1999 */ + white-space: -pre-wrap; /* Opera 4-6 */ + white-space: -o-pre-wrap; /* Opera 7 */ + word-wrap: break-word; /* Internet Explorer 5.5+ */ } pre { @@ -844,24 +927,37 @@ video { border: 1px solid #c0c0c0; } - -p.required, p.dataType {display: block; color: #c0c0c0; font-size: 80%; margin-left:4px;} - -dd {margin-left:20px;} - -.post-content img.inline { - margin:0px; - margin-bottom:6px; +p.required, +p.dataType { + display: block; + color: #c0c0c0; + font-size: 80%; + margin-left: 4px; } -.note code, .alert code, .warning code, div#toc code, h2 code, h3 code, h4 code { +dd { + margin-left: 20px; +} + +.post-content img.inline { + margin: 0px; + margin-bottom: 6px; +} + +.note code, +.alert code, +.warning code, +div#toc code, +h2 code, +h3 code, +h4 code { color: inherit; padding: 0px; } .alert { - margin-bottom:10px; - margin-top:10px; + margin-bottom: 10px; + margin-top: 10px; } a.accordion-toggle { @@ -870,12 +966,12 @@ a.accordion-toggle { span.red { color: red; - font-family: Monaco, Menlo, Consolas, "Courier New", monospace; + font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; } h3.codeExplanation { - font-size:18px; - font-style:normal; + font-size: 18px; + font-style: normal; color: black; line-height: 24px; } @@ -884,10 +980,6 @@ span.soft { color: #c0c0c0; } -.githubEditButton { - margin-bottom:7px; -} - .endpoint { padding: 15px; background-color: #f0f0f0; @@ -922,14 +1014,12 @@ span.soft { } @media (min-width: 1000px) { - ul#mysidebar { width: 225px; } } @media (max-width: 900px) { - ul#mysidebar { max-width: 100%; } @@ -940,7 +1030,6 @@ span.soft { max-height: 100%; } - .post-content img { margin: 12px 0px 3px 0px; width: auto; @@ -953,7 +1042,6 @@ span.soft { max-height: 100%; } - .post-content img { margin: 12px 0px 3px 0px; width: auto; @@ -964,13 +1052,13 @@ span.soft { .videoThumbs img { float: left; - margin:15px 15px 15px 0px; + margin: 15px 15px 15px 0px; box-shadow: 2px 2px 1px #f0f0f0; border: 1px solid #dedede; } - -@media only screen and (min-width: 900px), only screen and (min-device-width: 900px) { +@media only screen and (min-width: 900px), + only screen and (min-device-width: 900px) { .col-md-9 img { max-width: 700px; max-height: 700px; @@ -978,19 +1066,20 @@ span.soft { } *:hover > .anchorjs-link { - transition: color .25s linear; + transition: color 0.25s linear; text-decoration: none; } .kbCaption { color: white; background-color: #444; - padding:10px; + padding: 10px; } /* this part adds an icon after external links, using FontAwesome*/ -a[href^="http://"]:after, a[href^="https://"]:after { - content: "\f08e"; +a[href^="http://"]:after, a[href^="https://"]:after +{ + content: '\f08e'; font-family: FontAwesome; font-weight: normal; font-style: normal; @@ -1001,9 +1090,8 @@ a[href^="http://"]:after, a[href^="https://"]:after { /* Strip the outbound icon when this class is present */ a[href].noCrossRef::after, -a.no_icon:after - { - content:"" !important; +a.no_icon:after { + content: '' !important; padding-left: 0; } @@ -1061,17 +1149,18 @@ span.label.label-default { span.label.label-primary { background-color: #f0ad4e; } -.col-lg-12 .nav li a {background-color: white} - +.col-lg-12 .nav li a { + background-color: white; +} .nav li.active > a.subfoldersTitle { background-color: whitesmoke; font-weight: bold; color: black; - } +} a code { - color: #248EC2; + color: #248ec2; } code + a > code { @@ -1086,7 +1175,7 @@ ol li ul li ol li { list-style: decimal; } -ol li ul li ol li ul li{ +ol li ul li ol li ul li { list-style: disc; } @@ -1098,7 +1187,6 @@ table thead th code.highlighter-rouge { background-color: transparent; } - .box { padding: 10px; border: 1px solid #888; @@ -1125,7 +1213,7 @@ div.arrow { } div.content { - max-width: 110px + max-width: 110px; } .clearfix { @@ -1134,7 +1222,7 @@ div.content { .box1 { - margin-left:0px; + margin-left: 0px; } div.box.box1 { @@ -1148,12 +1236,12 @@ div.box.box1 { * [2] IE10+ */ /* 1 */ -.ie9 img[src$=".svg"] { +.ie9 img[src$='.svg'] { width: 100%; } /* 2 */ @media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) { - img[src$=".svg"] { + img[src$='.svg'] { width: 100%; } } @@ -1167,3 +1255,7 @@ h4.panel-title { width: 100px; height: 100px; } + +a.edit-header { + font-size: 15px; +} diff --git a/docs/css/pmd-customstyles.css b/docs/css/pmd-customstyles.css index 31c8985aad..2b73f4420f 100644 --- a/docs/css/pmd-customstyles.css +++ b/docs/css/pmd-customstyles.css @@ -28,6 +28,10 @@ width: 100%; } +header { + margin-top: 40px; +} + details { border-radius: 3px; background: #EEE; diff --git a/docs/js/customscripts.js b/docs/js/customscripts.js index f9a32a6d5e..3324a76545 100644 --- a/docs/js/customscripts.js +++ b/docs/js/customscripts.js @@ -1,14 +1,21 @@ - // Detect small devices and move the TOC in line function moveToc(){ if(window.innerWidth < 1350){ - $( "#toc" ).detach().appendTo("#inline-toc").removeClass("position-fixed"); + $( '#toc' ).detach().appendTo('#inline-toc').removeClass('position-fixed'); } else { - $( "#toc" ).detach().appendTo(".toc-col").addClass("position-fixed"); + $( '#toc' ).detach().appendTo('.toc-col').addClass('position-fixed'); } } -$( document ).ready(function() { +$(document).ready(function () { + // This handles the automatic toc. Use ## for subheads to auto-generate the on-page minitoc. + // If you use html tags, you must supply an ID for the heading element in order for it to appear in the minitoc. + $('#toc').toc({ + minimumHeaders: 0, + listType: 'ul', + showSpeed: 0, + headers: 'h2,h3,h4', + }); $('#mysidebar').height($(".nav").height()); @@ -18,18 +25,31 @@ $( document ).ready(function() { var h = $(window).height(); //console.log (h); if (h > 600) { - $( "#mysidebar" ).attr("class", "nav position-fixed"); + $( '#mysidebar' ).attr('class', 'nav position-fixed'); } // activate tooltips. although this is a bootstrap js function, it must be activated this way in your theme. $('[data-toggle="tooltip"]').tooltip({ - placement : 'top' + placement: 'top', }); /** * AnchorJS */ anchors.add('h2,h3,h4,h5'); + + // Add an "Edit on GitHub" button to each header (except h1) + let url = $('div.post-content').data('githubEditUrl'); + if ( url !== undefined ) { + $('div.post-content') + .find(':header:not(h1)') + .append( + ' ✏️️' + ); + } + // Check if TOC needs to be moved on page load moveToc(); @@ -37,10 +57,10 @@ $( document ).ready(function() { // when you're viewing a page. // Note: the class needs to be added before navgoco is initialized. Navgoco uses then this information // to expand the menus. - $("li.active").parents('li').toggleClass("active"); + $( 'li.active' ).parents('li').toggleClass('active'); // Initialize navgoco with default options - $("#mysidebar").navgoco({ + $( '#mysidebar' ).navgoco({ caretHtml: '', accordion: true, openClass: 'active', @@ -51,10 +71,6 @@ $( document ).ready(function() { } }); - // This handles the automatic toc. Use ## for subheads to auto-generate the on-page minitoc. - // If you use html tags, you must supply an ID for the heading element in order for it to appear in the minitoc. - $('#toc').toc({ minimumHeaders: 0, listType: 'ul', showSpeed: 0, headers: 'h2,h3,h4' }); - // Initialize jekyll search in topnav. SimpleJekyllSearch.init({ searchInput: document.getElementById('search-input'), @@ -85,4 +101,6 @@ $( document ).ready(function() { }); // Check if TOC needs to be moved on window resizing -$(window).resize(function () {moveToc();}); \ No newline at end of file +$(window).resize(function () { + moveToc(); +}); diff --git a/docs/js/tabstate.js b/docs/js/tabstate.js index 529dcc5bb3..3be37c1f37 100644 --- a/docs/js/tabstate.js +++ b/docs/js/tabstate.js @@ -5,38 +5,38 @@ $('a[data-toggle="pill"], a[data-toggle="tab"]').on('shown.bs.tab', function(e) { var tabId, json, parentId, tabsState; - tabsState = localStorage.getItem("tabs-state"); + tabsState = localStorage.getItem('tabs-state'); json = JSON.parse(tabsState || "{}"); - parentId = $(e.target).parents("ul.nav.nav-pills, ul.nav.nav-tabs").attr("id"); + parentId = $(e.target).parents('ul.nav.nav-pills, ul.nav.nav-tabs').attr('id'); tabId = $(e.target).attr('id'); json[parentId] = tabId; - return localStorage.setItem("tabs-state", JSON.stringify(json)); + return localStorage.setItem('tabs-state', JSON.stringify(json)); }); }; document.addEventListener('DOMContentLoaded', function () { var json, tabsState; - tabsState = localStorage.getItem("tabs-state"); - json = JSON.parse(tabsState || "{}"); + tabsState = localStorage.getItem('tabs-state'); + json = JSON.parse(tabsState || '{}'); $.each(json, function(containerId, tabId) { - if (containerId && containerId !== "undefined" && tabId && tabId !== "undefined" + if (containerId && containerId !== 'undefined' && tabId && tabId !== 'undefined' && tabId.indexOf('#') !== 0) { - $("#" + tabId).tab('show'); + $('#' + tabId).tab('show'); } }); - $("ul.nav.nav-pills, ul.nav.nav-tabs").each(function() { + $('ul.nav.nav-pills, ul.nav.nav-tabs').each(function() { var $this = $(this); - if (!json[$this.attr("id")]) { - return $this.find("a[data-toggle=tab]:first, a[data-toggle=pill]:first").tab("show"); + if (!json[$this.attr('id')]) { + return $this.find('a[data-toggle=tab]:first, a[data-toggle=pill]:first').tab('show'); } }); // cleanup "undefined" entries delete json['undefined']; - localStorage.setItem("tabs-state", JSON.stringify(json)); + localStorage.setItem('tabs-state', JSON.stringify(json)); registerTabEvent(); }); diff --git a/docs/pages/pmd/devdocs/building.md b/docs/pages/pmd/devdocs/building.md index 97196f2179..625b9bb2fb 100644 --- a/docs/pages/pmd/devdocs/building.md +++ b/docs/pages/pmd/devdocs/building.md @@ -84,9 +84,6 @@ Now the source and binary distribution zip files can be found in the folder `pmd **Notes:** -* The rules that have already been written are specified in the `src/main/resources/rulesets/` directories of -the specific languages, e.g. `pmd-java/src/main/resources/rulesets`. -They’re also in the jar file that’s included with both the source and binary distributions. - -A paucity of detail, I’m sure you’d agree. If you think this document can be improved, -please post [here](http://sourceforge.net/p/pmd/discussion/188192) and let me know how. Thanks! +- The rules that have already been written are specified in the `src/main/resources/category/` directories of + the specific languages, e.g. `pmd-java/src/main/resources/category`. + They’re also in the jar file that’s included with both the source and binary distributions. diff --git a/docs/pages/pmd/projectdocs/credits.md b/docs/pages/pmd/projectdocs/credits.md index fdac14b9c1..37e74a0d16 100644 --- a/docs/pages/pmd/projectdocs/credits.md +++ b/docs/pages/pmd/projectdocs/credits.md @@ -108,830 +108,831 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
Austin Tice

🐛
Ayoub Kaanich

🐛
BBG

💻 📖 🐛 +
Bailey Tjiong

💻
Barthélemy L.

🐛
Basavaraj K N

🐛 -
Basil Peace

🐛 +
Basil Peace

🐛
Belle

🐛
Ben Lerner

🐛
Ben Manes

🐛
Ben McCann

🐛
Bendegúz Nagy

🐛
Bennet S Yee

🐛 -
Benoit Lacelle

🐛 +
Benoit Lacelle

🐛
Bernardo Macêdo

🐛
Bernd Farka

🐛
Betina Cynthia Mamani

🐛
Bhanu Prakash Pamidi

💻 🐛
Bhargav Thanki

🐛
Binu R J

🐛 -
Björn Kautler

💻 🐛 +
Björn Kautler

💻 🐛
Blightbuster

🐛
Bo Zhang

🐛
Bob "Wombat" Hogg

🐛
Bobby Wertman

🐛
Bolarinwa Saheed Olayemi

💻 🐛
Boris Petrov

🐛 -
Brad Kent

🐛 +
Brad Kent

🐛
Brandon Mikeska

🐛
Brian Batronis

🐛
Brian Johnson

🐛
Brice Dutheil

💻 🐛
Bruno Ferreira

🐛
Bruno Ritz

🐛 -
Cameron Donaldson

🐛 +
Cameron Donaldson

🐛
Carlos Macasaet

🐛
Carsten Otto

🐛
Charlie Housh

🐛
Charlie Jonas

🐛
Chas Honton

🐛
Chen Yang

🐛 -
Chotu

🐛 +
Chotu

🐛
Chris Smith

🐛
Christian Hujer

🐛
Christian Pontesegger

🐛
ChristianWulf

🐛
Christofer Dutz

💻
Christoffer Anselm

🐛 -
Christophe Vidal

🐛 +
Christophe Vidal

🐛
Christopher Dancy

🐛
Clemens Prill

🐛
Clint Chester

💻 🐛
Clément Fournier

💻 📖 🐛 🚧
Codacy Badger

🐛
Code-Nil

🐛 -
ColColonCleaner

🐛 +
ColColonCleaner

🐛
Colin Ingarfield

🐛
Craig Andrews

🐛
Craig Muchinsky

🐛
Cyril

💻 🐛
Dale

💻
Damien Jiang

🐛 -
Dan Berindei

🐛 +
Dan Berindei

🐛
Dan Rollo

🐛
Dan Ziemba

🐛
Daniel Gredler

💻
Daniel Jipa

🐛
Daniel Paul Searles

💻
Daniel Reigada

🐛 -
Danilo Pianini

🐛 +
Danilo Pianini

🐛
Darko

🐛
David

🐛
David Atkinson

🐛
David Burström

💻 🐛
David Goaté

🐛
David Golpira

🐛 -
David Kovařík

🐛 +
David Kovařík

🐛
David M. Karr (fullname at gmail.com)

🐛
David Renz

💻 🐛
David Renz

🐛
Deleted user

🐛
Dell Green

🐛
Dem Pilafian

🐛 -
Den

🐛 +
Den

🐛
Denis Borovikov

💻 🐛
Dennie Reniers

💻 🐛
Dennis Kieselhorst

🐛
Derek P. Moore

🐛
Dichotomia

🐛
Dionisio Cortés Fernández

💻 🐛 -
Dmitri Bourlatchkov

🐛 +
Dmitri Bourlatchkov

🐛
Dmitriy Kuzmin

🐛
Dmytro Dashenkov

🐛
Drew Hall

🐛
Dumitru Postoronca

🐛
Dylan Adams

🐛
Eden Hao

🐛 -
Egor Bredikhin

🐛 +
Egor Bredikhin

🐛
Elan P. Kugelmass

🐛
Elder S.

🐛
Emile

🐛
Eric

🐛
Eric Kintzer

🐛
Eric Perret

🐛 -
Eric Squires

🐛 +
Eric Squires

🐛
Erich L Foster

🐛
Erik Bleske

🐛
Ernst Reissner

🐛
F.W. Dekker

🐛
Facundo

🐛
Federico Giust

🐛 -
Fedor Sherstobitov

🐛 +
Fedor Sherstobitov

🐛
Felix Lampe

🐛
Filip Golonka

🐛
Filipe Esperandio

💻 🐛
Francesco la Torre

🐛
Francisco Duarte

🐛
Frieder Bluemle

🐛 -
Frits Jalvingh

💻 🐛 +
Frits Jalvingh

💻 🐛
G. Bazior

🐛
Gabe Henkes

🐛
Genoud Magloire

🐛
Geoffrey555

🐛
Georg Romstorfer

🐛
Gio

🐛 -
Gol

🐛 +
Gol

🐛
Gonzalo Exequiel Ibars Ingman

💻 🐛
GooDer

🐛
Gregor Riegler

🐛
Grzegorz Olszewski

🐛
Gunther Schrijvers

💻 🐛
Gustavo Krieger

🐛 -
Guy Elsmore-Paddock

🐛 +
Guy Elsmore-Paddock

🐛
Görkem Mülayim

🐛
Hanzel Godinez

🐛
Harsh Kukreja

🐛
Heber

🐛
Henning Schmiedehausen

💻 🐛
Henning von Bargen

💻 -
Hervé Boutemy

🐛 +
Hervé Boutemy

🐛
Himanshu Pandey

🐛
Hokwang Lee

🐛
Hooperbloob

💻
Hung PHAN

🐛
IDoCodingStuffs

💻 🐛
Iccen Gan

🐛 -
Ignacio Mariano Tirabasso

🐛 +
Ignacio Mariano Tirabasso

🐛
Igor Melnichenko

🐛
Igor Moreno

🐛
Intelesis-MS

🐛
Iroha_

🐛
Ishan Srivastava

🐛
Ivano Guerini

🐛 -
Ivar Andreas Bonsaksen

🐛 +
Ivar Andreas Bonsaksen

🐛
Ivo Šmíd

🐛
JJengility

🐛
Jake Hemmerle

🐛
James Harrison

🐛
Jan

🐛
Jan Aertgeerts

💻 🐛 -
Jan Brümmer

🐛 +
Jan Brümmer

🐛
Jan Tříska

🐛
Jan-Lukas Else

🐛
Jason Williams

🐛
Jean-Paul Mayer

🐛
Jean-Simon Larochelle

🐛
Jeff Bartolotta

💻 🐛 -
Jeff Hube

💻 🐛 +
Jeff Hube

💻 🐛
Jeff Jensen

🐛
Jeff May

🐛
Jens Gerdes

🐛
Jeroen Borgers

🐛
Jerome Russ

🐛
JerritEic

💻 📖 -
Jiri Pejchal

🐛 +
Jiri Pejchal

🐛
Jithin Sunny

🐛
Jiří Škorpil

🐛
Joao Machado

🐛
Jochen Krauss

🐛
Johan Hammar

🐛
John Karp

🐛 -
John Zhang

🐛 +
John Zhang

🐛
John-Teng

💻 🐛
Jon Moroney

💻 🐛
Jonas Geiregat

🐛
Jonathan Wiesel

💻 🐛
Jordan

🐛
Jordi Llach

🐛 -
Jorge Solórzano

🐛 +
Jorge Solórzano

🐛
JorneVL

🐛
Jose Palafox

🐛
Jose Stovall

🐛
Joseph

💻
Joseph Heenan

🐛
Josh Feingold

💻 🐛 -
Josh Holthaus

🐛 +
Josh Holthaus

🐛
Joshua S Arquilevich

🐛
João Ferreira

💻 🐛
João Pedro Schmitt

🐛
Juan Martín Sotuyo Dodero

💻 📖 🐛 🚧
Juan Pablo Civile

🐛
Julian Voronetsky

🐛 -
Julien

🐛 +
Julien

🐛
Julius

🐛
JustPRV

🐛
Jörn Huxhorn

🐛
KThompso

🐛
Kai Amundsen

🐛
Karel Vervaeke

🐛 -
Karl-Andero Mere

🐛 +
Karl-Andero Mere

🐛
Karl-Philipp Richter

🐛
Karsten Silz

🐛
Kazuma Watanabe

🐛
Kev

🐛
Keve Müller

🐛
Kevin Guerra

💻 -
Kevin Jones

🐛 +
Kevin Jones

🐛
Kevin Wayne

🐛
Kieran Black

🐛
Kirill Zubov

🐛
Kirk Clemens

💻 🐛
Klaus Hartl

🐛
Koen Van Looveren

🐛 -
Kris Scheibe

💻 🐛 +
Kris Scheibe

💻 🐛
Kunal Thanki

🐛
Larry Diamond

💻 🐛
Lars Knickrehm

🐛
Leo Gutierrez

🐛
Lintsi

🐛
Linus Fernandes

🐛 -
Lixon Lookose

🐛 +
Lixon Lookose

🐛
Logesh

🐛
Lorenzo Gabriele

🐛
Loïc Ledoyen

🐛
Lucas Silva

🐛
Lucas Soncini

💻 🐛
Lukasz Slonina

🐛 -
Lukebray

🐛 +
Lukebray

🐛
Lyor Goldstein

🐛
MCMicS

🐛
Macarse

🐛
Machine account for PMD

💻
Maciek Siemczyk

🐛
Maikel Steneker

💻 🐛 -
Maksim Moiseikin

🐛 +
Maksim Moiseikin

🐛
Manfred Koch

🐛
Manuel Moya Ferrer

💻 🐛
Manuel Ryan

🐛
Marat Vyshegorodtsev

🐛
Marcel Härle

🐛
Marcello Fialho

🐛 -
Marcin Rataj

🐛 +
Marcin Rataj

🐛
Mark Adamcin

🐛
Mark Hall

💻 🐛
Mark Kolich

🐛
Mark Pritchard

🐛
Markus Rathgeb

🐛
Marquis Wang

🐛 -
Martin Feldsztejn

🐛 +
Martin Feldsztejn

🐛
Martin Lehmann

🐛
Martin Spamer

🐛
Martin Tarjányi

🐛
MatFl

🐛
Mateusz Stefanski

🐛
Mathieu Gouin

🐛 -
MatiasComercio

💻 🐛 +
MatiasComercio

💻 🐛
Matt Benson

🐛
Matt De Poorter

🐛
Matt Harrah

🐛
Matt Nelson

🐛
Matthew Amos

🐛
Matthew Duggan

🐛 -
Matthew Hall

🐛 +
Matthew Hall

🐛
Matías Fraga

💻 🐛
Maxime Robert

💻 🐛
Michael

🐛
Michael Bell

🐛
Michael Bernstein

🐛
Michael Clay

🐛 -
Michael Dombrowski

🐛 +
Michael Dombrowski

🐛
Michael Hausegger

🐛
Michael Hoefer

🐛
Michael Möbius

🐛
Michael N. Lipp

🐛
Michael Pellegrini

🐛
Michal Kordas

🐛 -
Michał Borek

🐛 +
Michał Borek

🐛
Michał Kuliński

🐛
Miguel Núñez Díaz-Montes

🐛
Mihai Ionut

🐛
Mirek Hankus

🐛
Mladjan Gadzic

🐛
MrAngry52

🐛 -
Muminur Choudhury

🐛 +
Muminur Choudhury

🐛
Mykhailo Palahuta

💻 🐛
Nagendra Kumar Singh

🐛
Nahuel Barrios

🐛
Nathan Braun

🐛
Nathan Reynolds

🐛
Nathan Reynolds

🐛 -
Nathanaël

🐛 +
Nathanaël

🐛
Nazdravi

🐛
Neha-Dhonde

🐛
Nicholas Doyle

🐛
Nick Butcher

🐛
Nico Gallinal

🐛
Nicola Dal Maso

🐛 -
Nicolas Filotto

💻 +
Nicolas Filotto

💻
Nikita Chursin

🐛
Niklas Baudy

🐛
Nikolas Havrikov

🐛
Nilesh Virkar

🐛
Nimit Patel

🐛
Niranjan Harpale

🐛 -
Noah Sussman

🐛 +
Noah Sussman

🐛
Noah0120

🐛
Noam Tamim

🐛
Noel Grandin

🐛
Olaf Haalstra

🐛
Oleg Pavlenko

🐛
Oleksii Dykov

💻 -
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

🐛
Stanislav Myachenkov

💻
Stefan Birkner

🐛
Stefan Bohn

🐛
Stefan Endrullis

🐛
Stefan Klöss-Schuster

🐛
Stefan Wolf

🐛 -
Stephan H. Wissel

🐛 +
Stephan H. Wissel

🐛
Stephen

🐛
Stephen Friedrich

🐛
Steve Babula

💻
Stexxe

🐛
Stian Lågstad

🐛
StuartClayton5

🐛 -
Supun Arunoda

🐛 +
Supun Arunoda

🐛
Suren Abrahamyan

🐛
SwatiBGupta1110

🐛
SyedThoufich

🐛
Szymon Sasin

🐛
T-chuangxin

🐛
TERAI Atsuhiro

🐛 -
TIOBE Software

💻 🐛 +
TIOBE Software

💻 🐛
Taylor Smock

🐛
Techeira Damián

💻 🐛
Ted Husted

🐛
TehBakker

🐛
The Gitter Badger

🐛
Theodoor

🐛 -
Thiago Henrique Hüpner

🐛 +
Thiago Henrique Hüpner

🐛
Thibault Meyer

🐛
Thomas Güttler

🐛
Thomas Jones-Low

🐛
Thomas Smith

💻 🐛
ThrawnCA

🐛
Thunderforge

💻 🐛 -
Tim van der Lippe

🐛 +
Tim van der Lippe

🐛
Tobias Weimer

💻 🐛
Tom Daly

🐛
Tomer Figenblat

🐛
Tomi De Lucca

💻 🐛
Torsten Kleiber

🐛
TrackerSB

🐛 -
Ullrich Hafner

🐛 +
Ullrich Hafner

🐛
Utku Cuhadaroglu

💻 🐛
Valentin Brandl

🐛
Valeria

🐛
Vasily Anisimov

🐛
Vickenty Fesunov

🐛
Victor Noël

🐛 -
Vincent Galloy

💻 +
Vincent Galloy

💻
Vincent HUYNH

🐛
Vincent Maurin

🐛
Vincent Privat

🐛
Vishhwas

🐛
Vitaly

🐛
Vitaly Polonetsky

🐛 -
Vojtech Polivka

🐛 +
Vojtech Polivka

🐛
Vsevolod Zholobov

🐛
Vyom Yadav

💻
Wang Shidong

🐛
Waqas Ahmed

🐛
Wayne J. Earl

🐛
Wchenghui

🐛 -
Will Winder

🐛 +
Will Winder

🐛
William Brockhus

💻 🐛
Wilson Kurniawan

🐛
Wim Deblauwe

🐛
Woongsik Choi

🐛
XenoAmess

💻 🐛
Yang

💻 -
YaroslavTER

🐛 +
YaroslavTER

🐛
Young Chan

💻 🐛
YuJin Kim

🐛
Yuri Dolzhenko

🐛
Yurii Dubinka

🐛
Zoltan Farkas

🐛
Zustin

🐛 -
aaronhurst-google

🐛 +
aaronhurst-google

🐛
alexmodis

🐛
andreoss

🐛
andrey81inmd

💻 🐛
anicoara

🐛
arunprasathav

🐛
asiercamara

🐛 -
astillich-igniti

💻 +
astillich-igniti

💻
avesolovksyy

🐛
avishvat

🐛
avivmu

🐛
axelbarfod1

🐛
b-3-n

🐛
balbhadra9

🐛 -
base23de

🐛 +
base23de

🐛
bergander

🐛
berkam

💻 🐛
breizh31

🐛
caesarkim

🐛
carolyujing

🐛
cesares-basilico

🐛 -
chrite

🐛 +
chrite

🐛
cobratbq

🐛
coladict

🐛
cosmoJFH

🐛
cristalp

🐛
crunsk

🐛
cwholmes

🐛 -
cyberjj999

🐛 +
cyberjj999

🐛
cyw3

🐛
d1ss0nanz

🐛
danbrycefairsailcom

🐛
dariansanity

🐛
darrenmiliband

🐛
davidburstrom

🐛 -
dbirkman-paloalto

🐛 +
dbirkman-paloalto

🐛
deepak-patra

🐛
dependabot[bot]

💻 🐛
dinesh150

🐛
diziaq

🐛
dreaminpast123

🐛
duanyanan

🐛 -
dutt-sanjay

🐛 +
dutt-sanjay

🐛
dylanleung

🐛
dzeigler

🐛
ekkirala

🐛
emersonmoura

🐛
fairy

🐛
filiprafalowicz

💻 -
foxmason

🐛 +
foxmason

🐛
frankegabor

🐛
frankl

🐛
freafrea

🐛
fsapatin

🐛
gracia19

🐛
guo fei

🐛 -
gurmsc5

🐛 +
gurmsc5

🐛
gwilymatgearset

💻 🐛
haigsn

🐛
hemanshu070

🐛
henrik242

🐛
hongpuwu

🐛
hvbtup

💻 🐛 -
igniti GmbH

🐛 +
igniti GmbH

🐛
ilovezfs

🐛
itaigilo

🐛
jakivey32

🐛
jbennett2091

🐛
jcamerin

🐛
jkeener1

🐛 -
jmetertea

🐛 +
jmetertea

🐛
johnra2

💻
josemanuelrolon

💻 🐛
kabroxiko

💻 🐛
karwer

🐛
kaulonline

🐛
kdaemonv

🐛 -
kenji21

💻 🐛 +
kenji21

💻 🐛
kfranic

🐛
khalidkh

🐛
krzyk

🐛
lasselindqvist

🐛
lihuaib

🐛
lonelyma1021

🐛 -
lpeddy

🐛 +
lpeddy

🐛
lujiefsi

💻
lyriccoder

🐛
marcelmore

🐛
matchbox

🐛
matthiaskraaz

🐛
meandonlyme

🐛 -
mikesive

🐛 +
mikesive

🐛
milossesic

🐛
mriddell95

🐛
mrlzh

🐛
msloan

🐛
mucharlaravalika

🐛
mvenneman

🐛 -
nareshl119

🐛 +
nareshl119

🐛
nicolas-harraudeau-sonarsource

🐛
noerremark

🐛
novsirion

🐛
oggboy

🐛
oinume

🐛
orimarko

💻 🐛 -
pallavi agarwal

🐛 +
pallavi agarwal

🐛
parksungrin

🐛
patpatpat123

🐛
patriksevallius

🐛
pbrajesh1

🐛
phoenix384

🐛
piotrszymanski-sc

💻 -
plan3d

🐛 +
plan3d

🐛
poojasix

🐛
prabhushrikant

🐛
pujitha8783

🐛
r-r-a-j

🐛
raghujayjunk

🐛
rajeshveera

🐛 -
rajeswarreddy88

🐛 +
rajeswarreddy88

🐛
recdevs

🐛
reudismam

💻 🐛
rijkt

🐛
rillig-tk

🐛
rmohan20

💻 🐛
rxmicro

🐛 -
ryan-gustafson

💻 🐛 +
ryan-gustafson

💻 🐛
sabi0

🐛
scais

🐛
sebbASF

🐛
sergeygorbaty

💻
shilko2013

🐛
simeonKondr

🐛 -
snajberk

🐛 +
snajberk

🐛
sniperrifle2004

🐛
snuyanzin

🐛 💻
sratz

🐛
stonio

🐛
sturton

💻 🐛
sudharmohan

🐛 -
suruchidawar

🐛 +
suruchidawar

🐛
svenfinitiv

🐛
tashiscool

🐛
test-git-hook

🐛
testation21

💻 🐛
thanosa

🐛
tiandiyixian

🐛 -
tobwoerk

🐛 +
tobwoerk

🐛
tprouvot

🐛
trentchilders

🐛
triandicAnt

🐛
trishul14

🐛
tsui

🐛
winhkey

🐛 -
witherspore

🐛 +
witherspore

🐛
wjljack

🐛
wuchiuwong

🐛
xingsong

🐛
xioayuge

🐛
xnYi9wRezm

💻 🐛
xuanuy

🐛 -
xyf0921

🐛 +
xyf0921

🐛
yalechen-cyw3

🐛
yasuharu-sato

🐛
zenglian

🐛
zgrzyt93

💻 🐛
zh3ng

🐛
zt_soft

🐛 -
ztt79

🐛 +
ztt79

🐛
zzzzfeng

🐛
Árpád Magosányi

🐛
任贵杰

🐛 diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index 31b9997389..9dcbe6be80 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -56,10 +56,15 @@ The CLI itself remains compatible, if you run PMD via command-line, no action is ### Fixed Issues +* apex + * [#3817](https://github.com/pmd/pmd/pull/3817): \[apex] Add designer bindings to display main attributes * apex-performance * [#3773](https://github.com/pmd/pmd/pull/3773): \[apex] EagerlyLoadedDescribeSObjectResult false positives with SObjectField.getDescribe() * core * [#3299](https://github.com/pmd/pmd/issues/3299): \[core] Deprecate system properties of PMDCommandLineInterface +* doc + * [#2504](https://github.com/pmd/pmd/issues/2504): \[doc] Improve "Edit me on github" button + * [#3812](https://github.com/pmd/pmd/issues/3812): \[doc] Documentation website table of contents broken on pages with many subheadings ### API Changes @@ -82,6 +87,11 @@ The CLI itself remains compatible, if you run PMD via command-line, no action is The whole class however was deprecated long ago already with 6.30.0. It is internal API and should not be used. +* In modelica, the rule classes {% jdoc modelica::lang.modelica.rule.AmbiguousResolutionRule %} + and {% jdoc modelica::lang.modelica.rule.ConnectUsingNonConnector %} have been deprecated, + since they didn't comply to the usual rule class naming conventions yet. + The replacements are in the subpackage `bestpractices`. + #### Experimental APIs * Together with the [new programmatic API](#new-programmatic-api) the interface @@ -96,6 +106,8 @@ The CLI itself remains compatible, if you run PMD via command-line, no action is ### External Contributions * [#3773](https://github.com/pmd/pmd/pull/3773): \[apex] EagerlyLoadedDescribeSObjectResult false positives with SObjectField.getDescribe() - [@filiprafalowicz](https://github.com/filiprafalowicz) +* [#3811](https://github.com/pmd/pmd/pull/3811): \[doc] Improve "Edit me on github" button - [@btjiong](https://github.com/btjiong) +* [#3836](https://github.com/pmd/pmd/pull/3836): \[doc] Make TOC scrollable when too many subheadings - [@JerritEic](https://github.com/JerritEic) {% endtocmaker %} diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ApexHandler.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ApexHandler.java index c83ec4cab6..ca41ee97c0 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ApexHandler.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ApexHandler.java @@ -11,6 +11,7 @@ import java.util.Set; import net.sourceforge.pmd.annotation.InternalApi; import net.sourceforge.pmd.lang.AbstractPmdLanguageVersionHandler; import net.sourceforge.pmd.lang.apex.ast.ApexParser; +import net.sourceforge.pmd.lang.apex.internal.ApexDesignerBindings; import net.sourceforge.pmd.lang.apex.metrics.ApexMetrics; import net.sourceforge.pmd.lang.apex.rule.internal.ApexRuleViolationFactory; import net.sourceforge.pmd.lang.ast.Parser; @@ -18,6 +19,7 @@ import net.sourceforge.pmd.lang.metrics.LanguageMetricsProvider; import net.sourceforge.pmd.lang.metrics.Metric; import net.sourceforge.pmd.lang.rule.RuleViolationFactory; import net.sourceforge.pmd.properties.PropertySource; +import net.sourceforge.pmd.util.designerbindings.DesignerBindings; @InternalApi public class ApexHandler extends AbstractPmdLanguageVersionHandler { @@ -46,6 +48,11 @@ public class ApexHandler extends AbstractPmdLanguageVersionHandler { return myMetricsProvider; } + @Override + public DesignerBindings getDesignerBindings() { + return ApexDesignerBindings.INSTANCE; + } + private static final class ApexMetricsProvider implements LanguageMetricsProvider { private final Set> metrics = setOf( diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/internal/ApexDesignerBindings.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/internal/ApexDesignerBindings.java new file mode 100644 index 0000000000..80dcb9bd65 --- /dev/null +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/internal/ApexDesignerBindings.java @@ -0,0 +1,64 @@ +/* + * BSD-style license; for more info see http://pmd.sourceforge.net/license.html + */ + +package net.sourceforge.pmd.lang.apex.internal; + +import net.sourceforge.pmd.lang.apex.ast.ASTFieldDeclaration; +import net.sourceforge.pmd.lang.apex.ast.ASTMethod; +import net.sourceforge.pmd.lang.apex.ast.ASTMethodCallExpression; +import net.sourceforge.pmd.lang.apex.ast.ASTUserClass; +import net.sourceforge.pmd.lang.apex.ast.ASTVariableDeclaration; +import net.sourceforge.pmd.lang.apex.ast.ApexNode; +import net.sourceforge.pmd.lang.apex.ast.ApexParserVisitorAdapter; +import net.sourceforge.pmd.lang.ast.Node; +import net.sourceforge.pmd.lang.ast.xpath.Attribute; +import net.sourceforge.pmd.util.designerbindings.DesignerBindings.DefaultDesignerBindings; + +public class ApexDesignerBindings extends DefaultDesignerBindings { + + public static final ApexDesignerBindings INSTANCE = new ApexDesignerBindings(); + + @Override + public Attribute getMainAttribute(Node node) { + if (node instanceof ApexNode) { + Attribute attr = (Attribute) ((ApexNode) node).jjtAccept(MainAttrVisitor.INSTANCE, null); + if (attr != null) { + return attr; + } + } + + return super.getMainAttribute(node); + } + + @Override + public TreeIconId getIcon(Node node) { + if (node instanceof ASTFieldDeclaration) { + return TreeIconId.FIELD; + } else if (node instanceof ASTUserClass) { + return TreeIconId.CLASS; + } else if (node instanceof ASTMethod) { + return TreeIconId.METHOD; + } else if (node instanceof ASTVariableDeclaration) { + return TreeIconId.VARIABLE; + } + return super.getIcon(node); + } + + + private static final class MainAttrVisitor extends ApexParserVisitorAdapter { + + private static final MainAttrVisitor INSTANCE = new MainAttrVisitor(); + + @Override + public Object visit(ApexNode node, Object data) { + return null; // don't recurse + } + + @Override + public Object visit(ASTMethodCallExpression node, Object data) { + return new Attribute(node, "MethodName", node.getMethodName()); + } + } + +} diff --git a/pmd-modelica/pom.xml b/pmd-modelica/pom.xml index bd121630ed..5b5a60558f 100644 --- a/pmd-modelica/pom.xml +++ b/pmd-modelica/pom.xml @@ -12,6 +12,12 @@ + + + ${basedir}/src/main/resources + true + + maven-resources-plugin diff --git a/pmd-modelica/src/main/java/net/sourceforge/pmd/lang/modelica/rule/AmbiguousResolutionRule.java b/pmd-modelica/src/main/java/net/sourceforge/pmd/lang/modelica/rule/AmbiguousResolutionRule.java index fcc1213d47..05e2d2302a 100644 --- a/pmd-modelica/src/main/java/net/sourceforge/pmd/lang/modelica/rule/AmbiguousResolutionRule.java +++ b/pmd-modelica/src/main/java/net/sourceforge/pmd/lang/modelica/rule/AmbiguousResolutionRule.java @@ -1,26 +1,13 @@ -/** +/* * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ + package net.sourceforge.pmd.lang.modelica.rule; -import net.sourceforge.pmd.lang.modelica.ast.ASTName; -import net.sourceforge.pmd.lang.modelica.resolver.ResolutionResult; -import net.sourceforge.pmd.lang.modelica.resolver.ResolvableEntity; +/** + * @deprecated Use {@link net.sourceforge.pmd.lang.modelica.rule.bestpractices.AmbiguousResolutionRule} + */ +public class AmbiguousResolutionRule extends net.sourceforge.pmd.lang.modelica.rule.bestpractices.AmbiguousResolutionRule { -public class AmbiguousResolutionRule extends AbstractModelicaRule { - @Override - public Object visit(ASTName node, Object data) { - ResolutionResult candidates = node.getResolutionCandidates(); - if (candidates.isClashed()) { - StringBuilder sb = new StringBuilder(); - sb.append("Candidate resolutions: "); - for (ResolvableEntity candidate: candidates.getBestCandidates()) { - sb.append(candidate.getDescriptiveName()); - sb.append(", "); - } - addViolation(data, node, sb.substring(0, sb.length() - 2)); - } - return super.visit(node, data); - } } diff --git a/pmd-modelica/src/main/java/net/sourceforge/pmd/lang/modelica/rule/ConnectUsingNonConnector.java b/pmd-modelica/src/main/java/net/sourceforge/pmd/lang/modelica/rule/ConnectUsingNonConnector.java index af444d5ba7..8698df8b36 100644 --- a/pmd-modelica/src/main/java/net/sourceforge/pmd/lang/modelica/rule/ConnectUsingNonConnector.java +++ b/pmd-modelica/src/main/java/net/sourceforge/pmd/lang/modelica/rule/ConnectUsingNonConnector.java @@ -1,50 +1,16 @@ -/** +/* * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ + package net.sourceforge.pmd.lang.modelica.rule; -import net.sourceforge.pmd.lang.modelica.ast.ASTComponentReference; -import net.sourceforge.pmd.lang.modelica.ast.ASTConnectClause; -import net.sourceforge.pmd.lang.modelica.resolver.ModelicaClassSpecialization; -import net.sourceforge.pmd.lang.modelica.resolver.ModelicaClassType; -import net.sourceforge.pmd.lang.modelica.resolver.ModelicaComponentDeclaration; -import net.sourceforge.pmd.lang.modelica.resolver.ResolutionResult; -import net.sourceforge.pmd.lang.modelica.resolver.ResolvableEntity; +import net.sourceforge.pmd.lang.modelica.rule.bestpractices.ConnectUsingNonConnectorRule; -public class ConnectUsingNonConnector extends AbstractModelicaRule { - private void reportIfViolated(ASTComponentReference ref, Object data) { - ResolutionResult resolution = ref.getResolutionCandidates(); - if (!resolution.isUnresolved()) { // no false positive if not resolved at all - ResolvableEntity firstDecl = resolution.getBestCandidates().get(0); - if (firstDecl instanceof ModelicaComponentDeclaration) { - ModelicaComponentDeclaration componentDecl = (ModelicaComponentDeclaration) firstDecl; - ResolutionResult componentTypes = componentDecl.getTypeCandidates(); - if (!componentTypes.isUnresolved()) { - if (componentTypes.getBestCandidates().get(0) instanceof ModelicaClassType) { - ModelicaClassType classDecl = (ModelicaClassType) componentTypes.getBestCandidates().get(0); - ModelicaClassSpecialization restriction = classDecl.getSpecialization(); - if (!classDecl.isConnectorLike()) { - addViolation(data, ref, restriction.toString()); - } - } else { - addViolation(data, ref, firstDecl.getDescriptiveName()); - } - } - } else { - addViolation(data, ref, firstDecl.getDescriptiveName()); - } - } - } +/** + * @deprecated Use {@link ConnectUsingNonConnectorRule} + */ +@Deprecated +public class ConnectUsingNonConnector extends ConnectUsingNonConnectorRule { - @Override - public Object visit(ASTConnectClause node, Object data) { - ASTComponentReference lhs = (ASTComponentReference) node.getChild(0); - ASTComponentReference rhs = (ASTComponentReference) node.getChild(1); - - reportIfViolated(lhs, data); - reportIfViolated(rhs, data); - - return super.visit(node, data); - } } diff --git a/pmd-modelica/src/main/java/net/sourceforge/pmd/lang/modelica/rule/bestpractices/AmbiguousResolutionRule.java b/pmd-modelica/src/main/java/net/sourceforge/pmd/lang/modelica/rule/bestpractices/AmbiguousResolutionRule.java new file mode 100644 index 0000000000..724018ca62 --- /dev/null +++ b/pmd-modelica/src/main/java/net/sourceforge/pmd/lang/modelica/rule/bestpractices/AmbiguousResolutionRule.java @@ -0,0 +1,27 @@ +/** + * BSD-style license; for more info see http://pmd.sourceforge.net/license.html + */ + +package net.sourceforge.pmd.lang.modelica.rule.bestpractices; + +import net.sourceforge.pmd.lang.modelica.ast.ASTName; +import net.sourceforge.pmd.lang.modelica.resolver.ResolutionResult; +import net.sourceforge.pmd.lang.modelica.resolver.ResolvableEntity; +import net.sourceforge.pmd.lang.modelica.rule.AbstractModelicaRule; + +public class AmbiguousResolutionRule extends AbstractModelicaRule { + @Override + public Object visit(ASTName node, Object data) { + ResolutionResult candidates = node.getResolutionCandidates(); + if (candidates.isClashed()) { + StringBuilder sb = new StringBuilder(); + sb.append("Candidate resolutions: "); + for (ResolvableEntity candidate: candidates.getBestCandidates()) { + sb.append(candidate.getDescriptiveName()); + sb.append(", "); + } + addViolation(data, node, sb.substring(0, sb.length() - 2)); + } + return super.visit(node, data); + } +} diff --git a/pmd-modelica/src/main/java/net/sourceforge/pmd/lang/modelica/rule/bestpractices/ConnectUsingNonConnectorRule.java b/pmd-modelica/src/main/java/net/sourceforge/pmd/lang/modelica/rule/bestpractices/ConnectUsingNonConnectorRule.java new file mode 100644 index 0000000000..5712bca82f --- /dev/null +++ b/pmd-modelica/src/main/java/net/sourceforge/pmd/lang/modelica/rule/bestpractices/ConnectUsingNonConnectorRule.java @@ -0,0 +1,51 @@ +/** + * BSD-style license; for more info see http://pmd.sourceforge.net/license.html + */ + +package net.sourceforge.pmd.lang.modelica.rule.bestpractices; + +import net.sourceforge.pmd.lang.modelica.ast.ASTComponentReference; +import net.sourceforge.pmd.lang.modelica.ast.ASTConnectClause; +import net.sourceforge.pmd.lang.modelica.resolver.ModelicaClassSpecialization; +import net.sourceforge.pmd.lang.modelica.resolver.ModelicaClassType; +import net.sourceforge.pmd.lang.modelica.resolver.ModelicaComponentDeclaration; +import net.sourceforge.pmd.lang.modelica.resolver.ResolutionResult; +import net.sourceforge.pmd.lang.modelica.resolver.ResolvableEntity; +import net.sourceforge.pmd.lang.modelica.rule.AbstractModelicaRule; + +public class ConnectUsingNonConnectorRule extends AbstractModelicaRule { + private void reportIfViolated(ASTComponentReference ref, Object data) { + ResolutionResult resolution = ref.getResolutionCandidates(); + if (!resolution.isUnresolved()) { // no false positive if not resolved at all + ResolvableEntity firstDecl = resolution.getBestCandidates().get(0); + if (firstDecl instanceof ModelicaComponentDeclaration) { + ModelicaComponentDeclaration componentDecl = (ModelicaComponentDeclaration) firstDecl; + ResolutionResult componentTypes = componentDecl.getTypeCandidates(); + if (!componentTypes.isUnresolved()) { + if (componentTypes.getBestCandidates().get(0) instanceof ModelicaClassType) { + ModelicaClassType classDecl = (ModelicaClassType) componentTypes.getBestCandidates().get(0); + ModelicaClassSpecialization restriction = classDecl.getSpecialization(); + if (!classDecl.isConnectorLike()) { + addViolation(data, ref, restriction.toString()); + } + } else { + addViolation(data, ref, firstDecl.getDescriptiveName()); + } + } + } else { + addViolation(data, ref, firstDecl.getDescriptiveName()); + } + } + } + + @Override + public Object visit(ASTConnectClause node, Object data) { + ASTComponentReference lhs = (ASTComponentReference) node.getChild(0); + ASTComponentReference rhs = (ASTComponentReference) node.getChild(1); + + reportIfViolated(lhs, data); + reportIfViolated(rhs, data); + + return super.visit(node, data); + } +} diff --git a/pmd-modelica/src/main/resources/category/modelica/bestpractices.xml b/pmd-modelica/src/main/resources/category/modelica/bestpractices.xml index 6db3a6c18e..d4ad841943 100644 --- a/pmd-modelica/src/main/resources/category/modelica/bestpractices.xml +++ b/pmd-modelica/src/main/resources/category/modelica/bestpractices.xml @@ -10,6 +10,7 @@ Rules which enforce generally accepted best practices. @@ -40,9 +41,10 @@ end SomeOtherName /* should be SomeName */; + class="net.sourceforge.pmd.lang.modelica.rule.bestpractices.ConnectUsingNonConnectorRule"> Modelica specification requires passing connectors to the `connect` clause, while some implementations tolerate using it on plain variables, etc.. @@ -74,8 +76,9 @@ end Example; + class="net.sourceforge.pmd.lang.modelica.rule.bestpractices.AmbiguousResolutionRule"> There is multiple candidates for this type resolution. While generally this is not an error, this may indicate a bug. diff --git a/pmd-test/src/main/java/net/sourceforge/pmd/AbstractRuleSetFactoryTest.java b/pmd-test/src/main/java/net/sourceforge/pmd/AbstractRuleSetFactoryTest.java index 16d70904b0..b8f6df5739 100644 --- a/pmd-test/src/main/java/net/sourceforge/pmd/AbstractRuleSetFactoryTest.java +++ b/pmd-test/src/main/java/net/sourceforge/pmd/AbstractRuleSetFactoryTest.java @@ -18,7 +18,6 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; -import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -28,6 +27,7 @@ import java.util.Properties; import java.util.Set; import java.util.StringTokenizer; import java.util.regex.Pattern; + import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; @@ -284,17 +284,16 @@ public abstract class AbstractRuleSetFactoryTest { } private List getRuleSetFileNames(String language) throws IOException { + List ruleSetFileNames = new ArrayList<>(); + ruleSetFileNames.addAll(getRuleSetFileNames(language, "rulesets/" + language + "/rulesets.properties")); + ruleSetFileNames.addAll(getRuleSetFileNames(language, "category/" + language + "/categories.properties")); + return ruleSetFileNames; + } + + private List getRuleSetFileNames(String language, String propertiesPath) throws IOException { List ruleSetFileNames = new ArrayList<>(); Properties properties = new Properties(); - @SuppressWarnings("PMD.CloseResource") - InputStream input = getClass().getResourceAsStream("rulesets/" + language + "/rulesets.properties"); - if (input == null) { - // this might happen if a language is only support by CPD, but not - // by PMD - System.err.println("No ruleset found for language " + language); - return Collections.emptyList(); - } - try (InputStream is = input) { + try (InputStream is = getClass().getResourceAsStream(propertiesPath)) { properties.load(is); } String fileNames = properties.getProperty("rulesets.filenames"); @@ -302,7 +301,6 @@ public abstract class AbstractRuleSetFactoryTest { while (st.hasMoreTokens()) { ruleSetFileNames.add(st.nextToken()); } - return ruleSetFileNames; }