How to only create a PR for matchedDependencies with Renovate - renovate

I want to only create a Pull Request for the below specified dependencies. All other dependencies should not be considered. The config below does not do that because I get separate PR's for all dependencies that do not match the rules I specified. For example I get a PR for SimpleInjector.
How can I get one PR only for the Dependencies that match, but no other PR's at all without creating explicit exclusion rules for every dependency?
"packageRules": [
{
"matchPackagePatterns": [
"System.*",
],
"excludePackageNames": ["Microsoft.CodeAnalysis.FxCopAnalyzers"],
"matchUpdateTypes": [
"minor",
"patch"
],
"groupName": "non major",
"groupSlug": "non-major"
}
]
}

There are two things to know that were key to solve this problem:
Rules get evaluated from top to bottom
All dependencies get updated by default
The config below disables all dependencies first and then selectively enables some dependencies again:
"packageRules": [
{
"matchPackagePatterns": ["*"],
"enabled": false
},
{
"matchPackagePatterns": [
"System.*",
],
"enabled": true
},
{
"matchUpdateTypes": [
"minor",
"patch"
],
"groupSlug": "non-major"
}
]

Read here: https://docs.renovatebot.com/configuration-options/#packagerules
Important to know: Renovate will evaluate all packageRules and not stop once it gets a first match. You should order your packageRules in ascending order of importance so that more important rules come later and can override settings from earlier rules if needed.

Related

Did Firebase Cloud Functions ESLint change recently?

I created a cloud function project with firebase a few months ago, and used linting.
I recently created a new cloud function project with linting, and now the linter is complaining about random rules I never set. I don't remember it enforcing nearly the amount of style rules a few months ago.
Things like:
This line has a length of 95. Maximum allowed is 80
Missing JSDoc comment
Missing Trailing comma
expected indentation of 2 spaces but found 4
Strings must use singlequote
It's also not letting me use async/await.
I found out I can individually set these rules in my .eslintrc.js file, but that's annoying and I don't want to do that. By default, why aren't these rules disabled? I just want basic rules that make sure my code won't fail when run, not random style preferences like single/double quotes and max line length.
Is there any way to use just basic linting functionality with firebase functions?
I ran into the same issue as you. The new, more strict linting rules seem to come from the fact that Firebase functions use the "google" eslint base configuration plugin by default now. Read more about configuring ESLint plugins in the docs. My older Firebase functions were using tslint without issue.
Here's what my .eslintrc.js file looked like while I was getting style errors from eslint:
module.exports = {
env: {
es6: true,
node: true,
},
extends: [
'eslint:recommended',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:import/typescript',
'google',
],
parser: '#typescript-eslint/parser',
parserOptions: {
project: ['tsconfig.json', 'tsconfig.dev.json'],
sourceType: 'module',
},
ignorePatterns: [
'/lib/**/*', // Ignore built files.
],
plugins: ['#typescript-eslint', 'import'],
rules: {
quotes: ['error', 'double'],
},
};
I deleted 'google' from the extends property, which seemed to resolve almost all of the style linting issues.
Now it looks like this:
module.exports = {
env: {
es6: true,
node: true,
},
extends: [
'eslint:recommended',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:import/typescript',
],
parser: '#typescript-eslint/parser',
parserOptions: {
project: ['tsconfig.json', 'tsconfig.dev.json'],
sourceType: 'module',
},
ignorePatterns: [
'/lib/**/*', // Ignore built files.
],
plugins: ['#typescript-eslint', 'import'],
rules: {
quotes: ['error', 'double'],
},
};
You can get rid of the google extends value but I would suggest keeping it and just turning off the rules that bother you the most, which for me is indentation and max length (of lines):
module.exports = {
root: true,
env: {
es6: true,
node: true,
},
extends: [
"eslint:recommended",
"google",
],
rules: {
"quotes": ["error", "double"],
"indent": ["off"],
"max-len": ["off"],
},
};
For anyone who is confused by this, there is a lint config file in the Cloud Functions folder that you can edit. As of this answer, that file is named .eslintrc.js.

Semantic-release release-notes-generator how to teach new types

Can anyone give us a hint how to configure #semantic-release/release-notes-generator to take extra commit types (those additional to preset ones) while generating release-notes?
Our commits-analyzer config:
"#semantic-release/commit-analyzer",
{
"preset": "angular",
"releaseRules": [
{
"type": "refactor",
"release": "patch"
},
{
"type": "minfeat",
"release": "patch"
}
]
}
At this moment we have no extra configuration for #semantic-release/release-notes-generator, and surely it requires some as new types don't show up in changelog that is generated by #semantic-release/changelog after release-notes-generator runs
You will have to implement your own conventional-changelog preset in order to handle those new commit type.
For example the default angular preset handles only certain commit types: https://github.com/conventional-changelog/conventional-changelog/blob/e865af4df8d06795cebc7af09364ade19119e089/packages/conventional-changelog-angular/writer-opts.js#L36

Cosmos DB Indexing Policy - Overlap?

I have been assigned to work on an existing Cosmos DB implementation. The indexing policy does not seem to make sense at first glance. I understand that "/*" is supposed to be "root and all paths under it". So, why would someone make a policy like this?
"includedPaths": [
{
"path": "/*"
},
{
"path": "/foo/?"
},
{
"path": "/bar/?"
}
]
In this case, "foo" and "bar" are legitimate attributes. However, I don't understand why they are specified explicitly, when "/*" is already present.
Ideas?

How do I add rules to pa11y-ci?

I need to customize the ruleset used by pa11y.
For instance let's say I want to follow WCAG2A but want to add some rules from WCAG2AA.
I tried with something like this for configuration in my .pa11yci-file:
{
"defaults": {
"standard": "WCAG2A",
"rules": ["WCAG2AA.Principle1.Guideline1_1.1_1_1.H30.2"],
"hideElements": "",
"ignore": [],
"includeWarnings": true,
"timeout": 5000,
"threshold": 0
},
"urls": [
{
"url": "https://www.ecster.se",
"actions": [
]
}]
}
But I only get this in the console:
Error: Evaluation failed: Error: WCAG2AA.Principle1.Guideline1_1.1_1_1.H30.2 is not a valid WCAG 2.0 rule
at configureHtmlCodeSniffer (<anonymous>:60:13)
at runPa11y (<anonymous>:30:3)
I get my rulenames from here:
https://github.com/pa11y/pa11y/wiki/HTML-CodeSniffer-Rules
Using latest version of pa11y-ci: 2.1.1.
Looking at the Pa11y documentation it looks as though you need to reference rules without the standard.
E.g. Principle1.Guideline1_1.1_1_1.H30.2, not WCAG2AA.Principle1.Guideline1_1.1_1_1.H30.2
Worth noting that that Guideline you've used as an example is already present in both WCAG2A and WCAG2AA. Might be worth trying with one that's only present in AA and above e.g. Principle3.Guideline3_1.3_1_2.H58.1.Lang
You should have a rules property with an array of rules you wish to include.
...
"rules": [ "standard.you.wish.to.include",...],
...

Google Cloud Datastore runQuery returning 412 "no matching index found"

** UPDATE **
Thanks to Alfred Fuller for pointing out that I need to create a manual index for this query.
Unfortunately, using the JSON API, from a .NET application, there does not appear to be an officially supported way of doing so. In fact, there does not officially appear to be a way to do this at all from an app outside of App Engine, which is strange since the Cloud Datastore API was designed to allow access to the Datastore outside of App Engine.
The closest hack I could find was to POST the index definition using RPC to http://appengine.google.com/api/datastore/index/add. Can someone give me the raw spec for how to do this exactly (i.e. URL parameters, what exactly should the body look like, etc), perhaps using Fiddler to inspect the call made by appcfg.cmd?
** ORIGINAL QUESTION **
According to the docs, "a query can combine equality (EQUAL) filters for different properties, along with one or more inequality filters on a single property".
However, this query fails:
{
"query": {
"kinds": [
{
"name": "CodeProse.Pogo.Tests.TestPerson"
}
],
"filter": {
"compositeFilter": {
"operator": "and",
"filters": [
{
"propertyFilter": {
"operator": "equal",
"property": {
"name": "DepartmentCode"
},
"value": {
"integerValue": "123"
}
}
},
{
"propertyFilter": {
"operator": "greaterThan",
"property": {
"name": "HourlyRate"
},
"value": {
"doubleValue": 50
}
}
},
{
"propertyFilter": {
"operator": "lessThan",
"property": {
"name": "HourlyRate"
},
"value": {
"doubleValue": 100
}
}
}
]
}
}
}
}
with the following response:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "FAILED_PRECONDITION",
"message": "no matching index found.",
"locationType": "header",
"location": "If-Match"
}
],
"code": 412,
"message": "no matching index found."
}
}
The JSON API does not yet support local index generation, but we've documented a process that you can follow to generate the xml definition of the index at https://developers.google.com/datastore/docs/tools/indexconfig#Datastore_Manual_index_configuration
Please give this a shot and let us know if it doesn't work.
This is a temporary solution that we hope to replace with automatic local index generation as soon as we can.
The error "no matching index found." indicates that an index needs to be added for the query to work. See the auto index generation documentation.
In this case you need an index with the properties DepartmentCode and HourlyRate (in that order).
For gcloud-node I fixed it with those 3 links:
https://github.com/GoogleCloudPlatform/gcloud-node/issues/369
https://github.com/GoogleCloudPlatform/gcloud-node/blob/master/system-test/data/index.yaml
and most important link:
https://cloud.google.com/appengine/docs/python/config/indexconfig#Python_About_index_yaml to write your index.yaml file
As explained in the last link, an index is what allows complex queries to run faster by storing the result set of the queries in an index. When you get no matching index found it means that you tried to run a complex query involving order or filter. So to make your query work, you need to create your index on the google datastore indexes by creating a config file manually to define your indexes that represent the query you are trying to run. Here is how you fix:
create an index.yaml file in a folder named for example indexes in your app directory by following the directives for the python conf file: https://cloud.google.com/appengine/docs/python/config/indexconfig#Python_About_index_yaml or get inspiration from the gcloud-node tests in https://github.com/GoogleCloudPlatform/gcloud-node/blob/master/system-test/data/index.yaml
create the indexes from the config file with this command:
gcloud preview datastore create-indexes indexes/index.yaml
see https://cloud.google.com/sdk/gcloud/reference/preview/datastore/create-indexes
wait for the indexes to serve on your developer console in Cloud Datastore/Indexes, the interface should display "serving" once the index is built
once it is serving your query should work
For example for this query:
var q = ds.createQuery('project')
.filter('tags =', category)
.order('-date');
index.yaml looks like:
indexes:
- kind: project
ancestor: no
properties:
- name: tags
- name: date
direction: desc
Try not to order the result. After removing orderby(), it worked for me.

Resources