Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Ignore] Testing Code QL #35

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/cicd-feature.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ on:
jobs:
build-and-test:
uses: ./.github/workflows/build-and-test.yml
analyze:
uses: ./.github/workflows/codeql-analysis.yml
2 changes: 2 additions & 0 deletions .github/workflows/cicd-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ on:
jobs:
build-and-test:
uses: ./.github/workflows/build-and-test.yml
analyze:
uses: ./.github/workflows/codeql-analysis.yml
65 changes: 65 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: 'CodeQL'

on:
workflow_call:

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: ['javascript']
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

steps:
- name: Checkout repository
uses: actions/checkout@v2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
28 changes: 14 additions & 14 deletions applications/browser-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,22 @@
"@crossbreeze/model-service": "^1.0.0",
"@crossbreeze/product": "0.0.0",
"@crossbreeze/property-view": "^1.0.0",
"@theia/core": "1.37.2",
"@theia/editor": "1.37.2",
"@theia/filesystem": "1.37.2",
"@theia/markers": "1.37.2",
"@theia/messages": "1.37.2",
"@theia/monaco": "1.37.2",
"@theia/navigator": "1.37.2",
"@theia/plugin-ext": "1.37.2",
"@theia/plugin-ext-vscode": "1.37.2",
"@theia/preferences": "1.37.2",
"@theia/process": "1.37.2",
"@theia/terminal": "1.37.2",
"@theia/workspace": "1.37.2"
"@theia/core": "1.43.1",
"@theia/editor": "1.43.1",
"@theia/filesystem": "1.43.1",
"@theia/markers": "1.43.1",
"@theia/messages": "1.43.1",
"@theia/monaco": "1.43.1",
"@theia/navigator": "1.43.1",
"@theia/plugin-ext": "1.43.1",
"@theia/plugin-ext-vscode": "1.43.1",
"@theia/preferences": "1.43.1",
"@theia/process": "1.43.1",
"@theia/terminal": "1.43.1",
"@theia/workspace": "1.43.1"
},
"devDependencies": {
"@theia/cli": "1.37.2"
"@theia/cli": "1.43.1"
},
"productName": "CrossModel Community Edition",
"theia": {
Expand Down
34 changes: 18 additions & 16 deletions applications/electron-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
},
"main": "scripts/electron-main.js",
"scripts": {
"build": "yarn bundle",
"bundle": "yarn rebuild && theia build --mode development",
"clean": "theia clean && rimraf lib && rimraf src-gen",
"deploy": "rimraf dist && electron-builder -c.mac.identity=null --publish always",
"download:plugins": "theia download:plugins",
Expand All @@ -25,7 +27,7 @@
"package:preview": "yarn package:pre && electron-builder -c.mac.identity=null --dir && yarn package:post",
"prepare": "theia build --mode development && yarn download:plugins",
"rebuild": "theia rebuild:electron --cacheRoot ../..",
"start": "yarn rebuild && cross-env NODE_ENV=development theia start --plugins=local-dir:plugins",
"start": "cross-env NODE_ENV=development theia start --plugins=local-dir:plugins",
"test": "jest --passWithNoTests",
"watch": "theia build --watch --mode development"
},
Expand All @@ -36,23 +38,23 @@
"@crossbreeze/model-service": "^1.0.0",
"@crossbreeze/product": "0.0.0",
"@crossbreeze/property-view": "^1.0.0",
"@theia/core": "1.37.2",
"@theia/editor": "1.37.2",
"@theia/electron": "1.37.2",
"@theia/filesystem": "1.37.2",
"@theia/markers": "1.37.2",
"@theia/messages": "1.37.2",
"@theia/monaco": "1.37.2",
"@theia/navigator": "1.37.2",
"@theia/plugin-ext": "1.37.2",
"@theia/plugin-ext-vscode": "1.37.2",
"@theia/preferences": "1.37.2",
"@theia/process": "1.37.2",
"@theia/terminal": "1.37.2",
"@theia/workspace": "1.37.2"
"@theia/core": "1.43.1",
"@theia/editor": "1.43.1",
"@theia/electron": "1.43.1",
"@theia/filesystem": "1.43.1",
"@theia/markers": "1.43.1",
"@theia/messages": "1.43.1",
"@theia/monaco": "1.43.1",
"@theia/navigator": "1.43.1",
"@theia/plugin-ext": "1.43.1",
"@theia/plugin-ext-vscode": "1.43.1",
"@theia/preferences": "1.43.1",
"@theia/process": "1.43.1",
"@theia/terminal": "1.43.1",
"@theia/workspace": "1.43.1"
},
"devDependencies": {
"@theia/cli": "1.37.2",
"@theia/cli": "1.43.1",
"electron": "^23.2.4",
"electron-builder": "^23.6.0"
},
Expand Down
2 changes: 1 addition & 1 deletion applications/electron-app/scripts/electron-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ process.env.THEIA_PLUGINS = [process.env.THEIA_PLUGINS, `local-dir:${path.resolv
.join(',');

// Handover to the auto-generated electron application handler.
require('../src-gen/frontend/electron-main.js');
require('../lib/backend/electron-main.js');
5 changes: 3 additions & 2 deletions applications/electron-app/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
* To reset delete this file and rerun theia build again.
*/
// @ts-check
const config = require('./gen-webpack.config.js');
const configs = require('./gen-webpack.config.js');
const nodeConfig = require('./gen-webpack.node.config.js');

/**
* Expose bundled modules on window.theia.moduleName namespace, e.g.
Expand All @@ -14,4 +15,4 @@ config.module.rules.push({
loader: require.resolve('@theia/application-manager/lib/expose-loader')
}); */

module.exports = config;
module.exports = [...configs, nodeConfig.config];
4 changes: 2 additions & 2 deletions extensions/crossmodel-lang/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@
],
"dependencies": {
"@crossbreeze/protocol": "0.0.0",
"@eclipse-glsp/layout-elk": "1.1.0-RC10",
"@eclipse-glsp/server": "1.1.0-RC10",
"@eclipse-glsp/layout-elk": "2.0.0",
"@eclipse-glsp/server": "2.0.0",
"chalk": "~4.1.2",
"chevrotain": "~10.4.2",
"commander": "~10.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import { CrossModelChangeBoundsOperationHandler } from '../handler/change-bounds
import { CrossModelCreateEdgeOperationHandler } from '../handler/create-edge-operation-handler';
import { CrossModelDeleteOperationHandler } from '../handler/delete-operation-handler';
import { CrossModelDropEntityOperationHandler } from '../handler/drop-entity-operation-handler';
import { CrossModelUpdateClientOperationHandler } from '../handler/update-glsp-client-handler';
import { CrossModelGModelFactory } from '../model/cross-model-gmodel-factory';
import { CrossModelIndex } from '../model/cross-model-index';
import { CrossModelState } from '../model/cross-model-state';
Expand Down Expand Up @@ -50,7 +49,6 @@ export class CrossModelDiagramModule extends DiagramModule {
binding.add(CrossModelDeleteOperationHandler); // delete elements
binding.add(CrossModelDropEntityOperationHandler);
binding.add(CrossModelAddEntityOperationHandler);
binding.add(CrossModelUpdateClientOperationHandler);
}

protected override configureContextActionProviders(binding: MultiBinding<ContextActionsProvider>): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
********************************************************************************/

import { AddEntityOperation } from '@crossbreeze/protocol';
import { Command, OperationHandler } from '@eclipse-glsp/server';
import { inject, injectable } from 'inversify';
import { Command, JsonOperationHandler, ModelState } from '@eclipse-glsp/server';
import { injectable, inject } from 'inversify';
import { DiagramNode, Entity } from '../../language-server/generated/ast';
import { createNodeToEntityReference } from '../../language-server/util/ast-util';
import { findAvailableNodeName } from '../../language-server/util/name-util';
Expand All @@ -15,19 +15,18 @@ import { CrossModelCommand } from './cross-model-command';
* An operation handler for the 'AddEntityOperation' that resolves the referenced entity by name and places it in a new node on the diagram.
*/
@injectable()
export class CrossModelAddEntityOperationHandler extends OperationHandler {
export class CrossModelAddEntityOperationHandler extends JsonOperationHandler {
override operationType = AddEntityOperation.KIND;

@inject(CrossModelState) protected state: CrossModelState;
@inject(ModelState) protected override modelState: CrossModelState;

createCommand(operation: AddEntityOperation): Command {
return new CrossModelCommand(this.state, () => this.createEntityNode(operation));
return new CrossModelCommand(this.modelState, () => this.createEntityNode(operation));
}

protected async createEntityNode(operation: AddEntityOperation): Promise<void> {
const container = this.state.diagramRoot;
const container = this.modelState.diagramRoot;
const refInfo = createNodeToEntityReference(container);
const scope = this.state.services.language.references.ScopeProvider.getScope(refInfo);
const scope = this.modelState.services.language.references.ScopeProvider.getScope(refInfo);
const entityDescription = scope.getElement(operation.entityName);

if (entityDescription) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,31 +1,30 @@
/********************************************************************************
* Copyright (c) 2023 CrossBreeze.
********************************************************************************/
import { ChangeBoundsOperation, Command, OperationHandler } from '@eclipse-glsp/server';
import { ChangeBoundsOperation, Command, JsonOperationHandler, ModelState } from '@eclipse-glsp/server';
import { inject, injectable } from 'inversify';
import { CrossModelState } from '../model/cross-model-state';
import { CrossModelCommand } from './cross-model-command';

@injectable()
export class CrossModelChangeBoundsOperationHandler extends OperationHandler {
operationType = ChangeBoundsOperation.KIND;
export class CrossModelChangeBoundsOperationHandler extends JsonOperationHandler {
operationType = ChangeBoundsOperation.KIND;
@inject(ModelState) protected override modelState: CrossModelState;

@inject(CrossModelState) protected state: CrossModelState;
createCommand(operation: ChangeBoundsOperation): Command {
return new CrossModelCommand(this.modelState, () => this.changeBounds(operation));
}

createCommand(operation: ChangeBoundsOperation): Command {
return new CrossModelCommand(this.state, () => this.changeBounds(operation));
}

protected changeBounds(operation: ChangeBoundsOperation): void {
operation.newBounds.forEach(elementAndBounds => {
const node = this.state.index.findDiagramNode(elementAndBounds.elementId);
if (node) {
// we store the given bounds directly in our diagram node
node.x = elementAndBounds.newPosition?.x || node.x;
node.y = elementAndBounds.newPosition?.y || node.y;
node.width = elementAndBounds.newSize.width;
node.height = elementAndBounds.newSize.height;
}
});
}
protected changeBounds(operation: ChangeBoundsOperation): void {
operation.newBounds.forEach(elementAndBounds => {
const node = this.modelState.index.findDiagramNode(elementAndBounds.elementId);
if (node) {
// we store the given bounds directly in our diagram node
node.x = elementAndBounds.newPosition?.x || node.x;
node.y = elementAndBounds.newPosition?.y || node.y;
node.width = elementAndBounds.newSize.width;
node.height = elementAndBounds.newSize.height;
}
});
}
}
Loading
Loading