Skip to content

Commit

Permalink
Surfacing warnings during successful runs (#4556)
Browse files Browse the repository at this point in the history
* Warning Feature quick build

* wip

* wip

* [MegaLinter] Apply linters fixes

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* [MegaLinter] Apply linters fixes

* wip

* wip

---------

Co-authored-by: Daniel Li <[email protected]>
Co-authored-by: bdovaz <[email protected]>
  • Loading branch information
3 people authored Feb 17, 2025
1 parent 5a076e0 commit 2a9fa16
Show file tree
Hide file tree
Showing 52 changed files with 569 additions and 61 deletions.
11 changes: 11 additions & 0 deletions .automation/test/css/.stylelintrc_bad.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"extends": "stylelint-config-standard",
"rules": {
"comment-empty-line-before": [
"always",
{
"severity": "warning"
}
]
}
}
2 changes: 1 addition & 1 deletion .automation/test/php/php_bad_2.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function takesAnInt(int $i) {
return [$i, "hello"];
}

$data = ["some text", 5];
$data = [ "some text", 5 ];
takesAnInt($data[0]);

$condition = rand(0, 5);
Expand Down
10 changes: 10 additions & 0 deletions .automation/test/php/php_good_1.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
<?php

/**
* PHP version 8
*
* @category Template_Class
* @package Template_Class
* @author Author <[email protected]>
* @license https://opensource.org/licenses/MIT MIT License
* @link http://localhost/
*/

echo "Hello World!", PHP_EOL;
22 changes: 21 additions & 1 deletion .automation/test/php/php_good_2.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,39 @@
<?php

/**
* @return array<string>
* PHP version 8
*
* @category Template_Class
* @package Template_Class
* @author Author <[email protected]>
* @license https://opensource.org/licenses/MIT MIT License
* @link http://localhost/
*/

/**
* Summary of helloName
* @param string $name test
* @return string[]
*/
function helloName(string $name): array
{
return ["hello", $name];
}

/**
* Summary of helloMegalinter
* @return void
*/
function helloMegalinter(): void
{
$hello = helloName("MegaLinter");
echo implode(" ", $hello) . PHP_EOL;
}

/**
* Summary of helloOrWorld
* @return void
*/
function helloOrWorld(): void
{
$random = rand(0, 10);
Expand Down
12 changes: 12 additions & 0 deletions .automation/test/php/phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="PHP_CodeSniffer" xsi:noNamespaceSchemaLocation="phpcs.xsd">
<rule ref="PEAR.Commenting">
<type>error</type>
</rule>
<rule ref="PEAR.Functions">
<type>warning</type>
</rule>
<rule ref="PEAR.WhiteSpace">
<type>warning</type>
</rule>
</ruleset>
2 changes: 2 additions & 0 deletions .automation/test/spell_vale/.vale.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ Packages = Microsoft

[*]
BasedOnStyles = Vale, Microsoft

Vale.Spelling = warning
10 changes: 6 additions & 4 deletions .automation/test/spell_vale/spell_bad_2.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
- Correct some broken links in `README` from "Mega-Linter" to "MegaLinter" (#1030)
- Correct some broken links in `README` from "Mega-Linter" to "MegaLinter" (#1030)
- Correct some broken links in `README` from "Mega-Linter" to "MegaLinter" (#1030)
Are you actualy going?

This is so advantageous to have an URL !
Are you actualy going?

and and

the the
32 changes: 32 additions & 0 deletions .automation/test/sql_tsql/.tsqllintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"rules": {
"case-sensitive-variables": "warning",
"conditional-begin-end": "error",
"count-star": "error",
"cross-database-transaction": "error",
"data-compression": "error",
"data-type-length": "error",
"delete-where": "error",
"disallow-cursors": "error",
"full-text": "error",
"information-schema": "error",
"keyword-capitalization": "error",
"linked-server": "error",
"multi-table-alias": "error",
"named-constraint": "error",
"non-sargable": "error",
"object-property": "error",
"print-statement": "error",
"schema-qualify": "error",
"select-star": "error",
"semicolon-termination": "error",
"set-ansi": "error",
"set-nocount": "error",
"set-quoted-identifier": "error",
"set-transaction-isolation-level": "error",
"set-variable": "error",
"update-where": "error",
"upper-lower": "error",
"unicode-string": "error"
}
}
7 changes: 5 additions & 2 deletions .automation/test/sql_tsql/sql_bad_1.sql
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
SELECT;
GO;
DECLARE @VariableName INT,
@SomeOtherVariable INT;

SELECT @variableName = 1;
SELECT @someOtherVariable = 1;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"Modules":[{"Key":"","Source":"","Dir":"."},{"Key":"module1","Source":"./module","Dir":"module"},{"Key":"module1.module2","Source":"./module","Dir":"module/module"}]}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module "module1" {
source = "./module"

foo = "foo"
bar = "bar"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
variable "foo" {}
variable "bar" {}
variable "baz" {}

module "module2" {
source = "./module"

red = "${var.foo}-${var.bar}"
blue = "blue"
green = "${var.foo}-${var.baz}-${path.module}"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
variable "red" {}
variable "blue" {}
variable "green" {}
variable "yellow" {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
variable "override" {
default = "baz"
}
variable "no_default" {}
variable "unknown" {}

module "test" {
source = "./module1"

override = "${var.override}"
no_default = "${var.no_default}"
unknown = "${var.unknown}"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
variable "override" {
default = "baz"
}
variable "no_default" {}
variable "unknown" {}

resource "aws_instance" "web" {
ami = "ami-b73b63a0"
instance_type = "t1.2xlarge"

tags {
Name = "HelloWorld"
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
variable "override" {
default = "baz"
}
variable "no_default" {}
variable "unknown" {}

resource "aws_instance" "web" {
ami = "ami-b73b63a0"
instance_type = "t1.2xlarge"

tags {
Name = "HelloWorld"
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"Modules":[{"Key":"root","Source":"./module","Dir":"module"},{"Key":"root.test","Source":"./module1","Dir":"module/module1"},{"Key":"1.root;./module","Source":"./module","Dir":".terraform/modules/07be448a6067a2bba065bff4beea229d"},{"Key":"1.root;./module|test;./module1","Source":"./module1","Dir":".terraform/modules/a8d8930bc3c2ae53bf6e3bbcb3083d7b"},{"Key":"","Source":"","Dir":"."}]}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module "root" {
source = "./module"

override = "foo"
no_default = "bar"
unknown = "${data.aws.ami.id}"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
variable "override" {
default = "baz"
}
variable "no_default" {}
variable "unknown" {}

module "test" {
source = "./module1"

override = "${var.override}"
no_default = "${var.no_default}"
unknown = "${var.unknown}"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
variable "override" {
default = "baz"
}
variable "no_default" {}
variable "unknown" {}

resource "aws_instance" "web" {
ami = "ami-b73b63a0"
instance_type = "t1.2xlarge"

tags {
Name = "HelloWorld"
}
}

resource "aws_instance" "web2" {
ami = "ami-b73b63a1"
instance_type = "t1.2xlarge"

tags {
Name = "HelloWorld2"
}
}

19 changes: 19 additions & 0 deletions .automation/test/terraform_tflint/bad/terraform_bad_1.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
terraform {
required_version = ">= 1.8.5"
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 5.55.0" # https://registry.terraform.io/providers/hashicorp/aws/latest
}
}
}

provider "template" {}

provider "aws" {
region = "us-west-2"
}

resource "aws_s3_bucket" "example" {
bucket = "my-tf-test-bucket-${random_id.bucket_suffix.hex}"
}
28 changes: 28 additions & 0 deletions .automation/test/terraform_tflint/good/terraform_good_1.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
terraform {
required_version = ">= 1.8.5"
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 5.55.0" # https://registry.terraform.io/providers/hashicorp/aws/latest
}
}
}

provider "aws" {
region = "us-west-2"
}

resource "aws_s3_bucket" "example" {
bucket = "my-tf-test-bucket-${random_id.bucket_suffix.hex}"
}

resource "aws_s3_bucket_versioning" "example" {
bucket = aws_s3_bucket.example.id
versioning_configuration {
status = "Enabled"
}
}

resource "random_id" "bucket_suffix" {
byte_length = 4
}
34 changes: 34 additions & 0 deletions .automation/test/terraform_tflint/good/terraform_good_2.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
terraform {
required_version = ">= 1.8.5"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = ">= 3.109.0" # https://registry.terraform.io/providers/hashicorp/azurerm/latest
}
}
}

provider "azurerm" {
features {}
}

resource "azurerm_resource_group" "example" {
name = "example-resources"
location = "East US"
}

resource "azurerm_storage_account" "example" {
name = "storageacc${random_id.suffix.hex}"
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
account_tier = "Standard"
account_replication_type = "GRS"

tags = {
environment = "staging"
}
}

resource "random_id" "suffix" {
byte_length = 8
}
30 changes: 30 additions & 0 deletions .automation/test/terraform_tflint/good/terraform_good_3.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
terraform {
required_version = ">= 1.8.5"
required_providers {
google = {
source = "hashicorp/google"
version = ">= 5.34.0" # https://registry.terraform.io/providers/hashicorp/google/latest
}
}
}

provider "google" {
project = "my-project-id"
region = "us-central1"
}

resource "google_storage_bucket" "example" {
name = "my-bucket-${random_id.suffix.hex}"
location = "US"
force_destroy = true

uniform_bucket_level_access = true

versioning {
enabled = true
}
}

resource "random_id" "suffix" {
byte_length = 4
}
Loading

0 comments on commit 2a9fa16

Please sign in to comment.