All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.sonar.css.checks.RuleDescriptionsGenerator Maven / Gradle / Ivy

There is a newer version: 4.13
Show newest version
/*
 * SonarQube CSS / SCSS / Less Analyzer
 * Copyright (C) 2013-2017 David RACODON
 * mailto: [email protected]
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */
package org.sonar.css.checks;

import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringEscapeUtils;
import org.sonar.css.checks.common.CaseCheck;
import org.sonar.css.checks.common.UnknownTypeSelectorCheck;
import org.sonar.css.model.StandardCssObject;
import org.sonar.css.model.StandardCssObjectFactory;
import org.sonar.css.model.Vendor;
import org.sonar.css.model.atrule.StandardAtRule;
import org.sonar.css.model.function.StandardFunction;
import org.sonar.css.model.function.StandardFunctionFactory;
import org.sonar.css.model.property.StandardProperty;
import org.sonar.css.model.property.StandardPropertyFactory;
import org.sonar.css.model.pseudo.StandardPseudoComponent;

import java.io.*;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;

public class RuleDescriptionsGenerator {

  private static final String UTF_8 = "UTF-8";

  private static final Map CSS_OBJECT_LINKS = Maps.newLinkedHashMap();

  static {
    CSS_OBJECT_LINKS.put("#", "https://developer.mozilla.org/en-US/docs/Web/CSS/Value_definition_syntax#Hash_mark_()");
    CSS_OBJECT_LINKS.put("\\|\\|", "https://developer.mozilla.org/en-US/docs/Web/CSS/Value_definition_syntax#Double_bar");
    CSS_OBJECT_LINKS.put("(?", "http://dev.w3.org/csswg/css-values-3/#angle-value");
    CSS_OBJECT_LINKS.put("", "http://dev.w3.org/csswg/css-shapes/#typedef-basic-shape");
    CSS_OBJECT_LINKS.put("", "http://dev.w3.org/csswg/css-backgrounds-3/#border-style");
    CSS_OBJECT_LINKS.put("", "http://dev.w3.org/csswg/css-backgrounds-3/#border-width");
    CSS_OBJECT_LINKS.put("", "http://dev.w3.org/csswg/css-backgrounds-3/#box");
    CSS_OBJECT_LINKS.put("", "http://dev.w3.org/csswg/css-color/#typedef-color");
    CSS_OBJECT_LINKS.put("", "http://dev.w3.org/csswg/css-counter-styles-3/#typedef-counter-style");
    CSS_OBJECT_LINKS.put("", "http://www.w3.org/TR/css3-speech/#cue-after");
    CSS_OBJECT_LINKS.put("", "http://www.w3.org/TR/css3-speech/#cue-before");
    CSS_OBJECT_LINKS.put("", "https://www.w3.org/TR/CSS22/fonts.html#value-def-family-name");
    CSS_OBJECT_LINKS.put("", "http://dev.w3.org/fxtf/filters/#typedef-filter-function");
    CSS_OBJECT_LINKS.put("", "http://dev.w3.org/csswg/css-flexbox-1/#propdef-flex-direction");
    CSS_OBJECT_LINKS.put("", "http://dev.w3.org/csswg/css-flexbox-1/#propdef-flex-wrap");
    CSS_OBJECT_LINKS.put("", "http://dev.w3.org/csswg/css-values-3/#frequency-value");
    CSS_OBJECT_LINKS.put("", "https://wiki.csswg.org/ideas/functional-notation");
    CSS_OBJECT_LINKS.put("", "https://www.w3.org/TR/CSS22/fonts.html#value-def-generic-family");
    CSS_OBJECT_LINKS.put("", "https://drafts.csswg.org/css-ui/#typedef-id");
    CSS_OBJECT_LINKS.put("", "http://dev.w3.org/csswg/css-values-3/#identifier-value");
    CSS_OBJECT_LINKS.put("", "https://drafts.csswg.org/css-images-3/#typedef-image");
    CSS_OBJECT_LINKS.put("", "http://dev.w3.org/csswg/css-values-3/#integer-value");
    CSS_OBJECT_LINKS.put("", "http://dev.w3.org/csswg/css-values-3/#length-value");
    CSS_OBJECT_LINKS.put("", "http://www.w3.org/TR/css3-linebox/#line-stacking-ruby");
    CSS_OBJECT_LINKS.put("", "http://www.w3.org/TR/css3-linebox/#line-stacking-shift");
    CSS_OBJECT_LINKS.put("", "http://www.w3.org/TR/css3-linebox/#line-stacking-strategy");
    CSS_OBJECT_LINKS.put("", "http://dev.w3.org/csswg/css-lists-3/#propdef-list-style-position");
    CSS_OBJECT_LINKS.put("", "http://dev.w3.org/csswg/css-lists-3/#propdef-list-style-image");
    CSS_OBJECT_LINKS.put("", "http://dev.w3.org/csswg/css-lists-3/#propdef-list-style-type");
    CSS_OBJECT_LINKS.put("", "http://www.w3.org/TR/CSS2/box.html#value-def-margin-width");
    CSS_OBJECT_LINKS.put("", "http://dev.w3.org/csswg/css-values-3/#number-value");
    CSS_OBJECT_LINKS.put("", "http://www.w3.org/TR/CSS2/ui.html#propdef-outline-color");
    CSS_OBJECT_LINKS.put("", "http://www.w3.org/TR/CSS2/ui.html#propdef-outline-style");
    CSS_OBJECT_LINKS.put("", "http://www.w3.org/TR/CSS2/ui.html#propdef-outline-width");
    CSS_OBJECT_LINKS.put("", "http://www.w3.org/TR/CSS2/box.html#value-def-padding-width");
    CSS_OBJECT_LINKS.put("", "https://drafts.csswg.org/css-speech-1/#pause-after");
    CSS_OBJECT_LINKS.put("", "https://drafts.csswg.org/css-speech-1/#pause-before");
    CSS_OBJECT_LINKS.put("", "http://dev.w3.org/csswg/css-values-3/#percentage-value");
    CSS_OBJECT_LINKS.put("", "http://dev.w3.org/csswg/css-values-3/#resolution-value");
    CSS_OBJECT_LINKS.put("", "http://dev.w3.org/csswg/css-values-3/#url-value");
    CSS_OBJECT_LINKS.put("", "http://www.w3.org/TR/css3-animations/#single-animation-name");
    CSS_OBJECT_LINKS.put("", "http://www.w3.org/TR/css3-animations/#single-animation-direction");
    CSS_OBJECT_LINKS.put("", "http://www.w3.org/TR/css3-animations/#single-animation-fill-mode");
    CSS_OBJECT_LINKS.put("", "http://www.w3.org/TR/css3-animations/#single-animation-iteration-count");
    CSS_OBJECT_LINKS.put("", "http://www.w3.org/TR/css3-animations/#single-animation-play-state");
    CSS_OBJECT_LINKS.put("", "https://drafts.csswg.org/css-shapes/#typedef-shape-box");
    CSS_OBJECT_LINKS.put("", "http://www.w3.org/TR/2012/WD-css3-transitions-20120403/#transition-timing-function");
    CSS_OBJECT_LINKS.put("", "http://dev.w3.org/csswg/css-values-3/#string-value");
    CSS_OBJECT_LINKS.put("", "https://drafts.csswg.org/css-ui/#typedef-target-name");
    CSS_OBJECT_LINKS.put("




© 2015 - 2024 Weber Informatics LLC | Privacy Policy