Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

xqlint

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xqlint - npm Package Compare versions

Comparing version 0.3.4 to 0.4.0

.idea/modules.xml

9

lib/cli/cli.js

@@ -112,2 +112,9 @@ 'use strict';

)
.option(
'-p, --processor <name>',
'XQuery/JSONiq Processor (e.g. 28msec)',
function(value) {
return value.toLowerCase();
}
)
.description('Check queries')

@@ -127,3 +134,3 @@ .action(function(p) {

var source = fs.readFileSync(file, 'utf-8').replace(/^\uFEFF/, '');
var linter = new XQLint(source, { fileName: file, styleCheck: lintCmd.styleCheck });
var linter = new XQLint(source, { fileName: file, styleCheck: lintCmd.styleCheck, processor: lintCmd.processor });
var markers = linter.getMarkers().sort(function(a, b){ return a.sl - b.sl; });

@@ -130,0 +137,0 @@ var lines = source.split('\n');

66

lib/compiler/static_context.js

@@ -1,2 +0,2 @@

exports.StaticContext = function (parent, pos) {
exports.StaticContext = function (parent, pos, processor) {
'use strict';

@@ -30,14 +30,2 @@

};
namespaces['http://www.28msec.com/modules/collections'] = {
prefixes: ['db'],
pos: emptyPos,
type: 'module',
override: true
};
namespaces['http://www.28msec.com/modules/store'] = {
prefixes: ['store'],
pos: emptyPos,
type: 'module',
override: true
};
namespaces['http://jsoniq.org/function-library'] = {

@@ -82,14 +70,2 @@ prefixes: ['libjn'],

};
namespaces['http://zorba.io/annotations'] = {
prefixes: ['an'],
pos: emptyPos,
type: 'declare',
override: true
};
namespaces['http://www.28msec.com/annotations/rest'] = {
prefixes: ['rest'],
pos: emptyPos,
type: 'declare',
override: true
};
namespaces['http://www.w3.org/2005/xqt-errors'] = {

@@ -101,8 +77,2 @@ prefixes: ['err'],

};
namespaces['http://zorba.io/errors'] = {
prefixes: ['zerr'],
pos: emptyPos,
type: 'declare',
override: true
};
}

@@ -287,2 +257,3 @@

var found = [];
var that = this;
var handler = function (uri) {

@@ -295,3 +266,2 @@ var namespace = that.namespaces[uri];

};
var that = this;
while (that) {

@@ -464,3 +434,35 @@ Object.keys(that.namespaces).forEach(handler);

s.root = parent ? parent.root : s;
if(processor === '28msec') {
namespaces['http://www.28msec.com/modules/collections'] = {
prefixes: ['db'],
pos: emptyPos,
type: 'module',
override: true
};
namespaces['http://www.28msec.com/modules/store'] = {
prefixes: ['store'],
pos: emptyPos,
type: 'module',
override: true
};
namespaces['http://zorba.io/annotations'] = {
prefixes: ['an'],
pos: emptyPos,
type: 'declare',
override: true
};
namespaces['http://www.28msec.com/annotations/rest'] = {
prefixes: ['rest'],
pos: emptyPos,
type: 'declare',
override: true
};
namespaces['http://zorba.io/errors'] = {
prefixes: ['zerr'],
pos: emptyPos,
type: 'declare',
override: true
};
}
return s;
};

@@ -11,3 +11,23 @@ exports.Translator = function(rootStcx, ast){

var Handlers = require('./handlers');
var markers = [];
var addStaticError = function(e){
markers.push({
pos: e.getPos(),
type: 'error',
level: 'error',
message: '[' + e.getCode() + '] ' + e.getMessage()
});
};
var addWarning = function(code, message, pos) {
markers.push({
pos: pos,
type: 'warning',
level: 'warning',
message: '[' + code + '] ' + message
});
};
var get = function(node, path){

@@ -27,4 +47,3 @@ var result = [];

};
var markers = [];
this.apply = function(fn) {

@@ -43,21 +62,3 @@ try {

};
var addStaticError = function(e){
markers.push({
pos: e.getPos(),
type: 'error',
level: 'error',
message: '[' + e.getCode() + '] ' + e.getMessage()
});
};
var addWarning = function(code, message, pos) {
markers.push({
pos: pos,
type: 'warning',
level: 'warning',
message: '[' + code + '] ' + message
});
};
this.getMarkers = function(){

@@ -64,0 +65,0 @@ return markers;

@@ -37,2 +37,26 @@ exports.JSONParseTreeHandler = function (code) {

function setValue(node, begin, end) {
var e = end - cursor;
ptr.value = remains.substring(0, e);
remains = remains.substring(e);
cursor = end;
var sl = line;
var sc = lineCursor;
var el = sl + ptr.value.split('\n').length - 1;
var lastIdx = ptr.value.lastIndexOf('\n');
var ec = lastIdx === -1 ? sc + ptr.value.length : ptr.value.substring(lastIdx + 1).length;
// ec = ec === 0 ? 0 : ec - 1;
line = el;
//lineCursor = ec === 0 ? 0 : ec;
lineCursor = ec;
ptr.pos.sl = sl;
ptr.pos.sc = sc;
ptr.pos.el = el;
ptr.pos.ec = ec;
}
function pushNode(name) { //begin

@@ -140,26 +164,2 @@ var node = createNode(name);

};
function setValue(node, begin, end) {
var e = end - cursor;
ptr.value = remains.substring(0, e);
remains = remains.substring(e);
cursor = end;
var sl = line;
var sc = lineCursor;
var el = sl + ptr.value.split('\n').length - 1;
var lastIdx = ptr.value.lastIndexOf('\n');
var ec = lastIdx === -1 ? sc + ptr.value.length : ptr.value.substring(lastIdx + 1).length;
// ec = ec === 0 ? 0 : ec - 1;
line = el;
//lineCursor = ec === 0 ? 0 : ec;
lineCursor = ec;
ptr.pos.sl = sl;
ptr.pos.sc = sc;
ptr.pos.el = el;
ptr.pos.ec = ec;
}
};

@@ -14,5 +14,5 @@ 'use strict';

var createStaticContext = exports.createStaticContext = function(){
var createStaticContext = exports.createStaticContext = function(processor){
var StaticContext = require('./compiler/static_context').StaticContext;
return new StaticContext();
return new StaticContext(undefined, undefined, processor);
};

@@ -46,3 +46,3 @@

var ast, xqdoc;
var sctx = opts.staticContext ? opts.staticContext : createStaticContext();
var sctx = opts.staticContext ? opts.staticContext : createStaticContext(opts.processor);

@@ -49,0 +49,0 @@ this.getAST = function () {

@@ -9,3 +9,3 @@ {

"description": "XQuery & JSONiq Quality Checker",
"version": "0.3.4",
"version": "0.4.0",
"keywords": [

@@ -40,3 +40,3 @@ "jsoniq",

"grunt-browserify": "~2.1.1",
"grunt-contrib-jshint": "~0.10.0",
"grunt-contrib-jshint": "1.1.0",
"grunt-vows": "~0.4.1",

@@ -43,0 +43,0 @@ "matchdep": "~0.3.0",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc