Skip to content
Merged
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 .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Run pre-commit hooks for commit-msg stage
pre-commit run --hook-stage commit-msg --commit-msg-filename "$1"
9 changes: 4 additions & 5 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
# Lint FE code
echo "Formatting and linting FE code"
echo "Formatting and linting FE code..."
pnpm exec lint-staged

# Capture list of staged files
STAGED_FILES=$(git diff --name-only --cached)


# Format BE code
echo "Formatting BE code"
pre-commit run
echo "Formatting BE code..."
pre-commit run --all-files

echo "Committing changes"
# You may want to consider also running `pre-commit autoupdate` periodically to keep hooks updated.
19 changes: 17 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,35 @@
files: '^java/.*java'
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
rev: v6.0.0
hooks:
- id: check-merge-conflict
- id: end-of-file-fixer
files: '^(java/.*\.java|py.*\.py)$'
- id: trailing-whitespace
files: '^(java/.*\.java|py.*\.py)$'
- id: mixed-line-ending
args: ['--fix=auto']
files: '^(java/.*\.java|py.*\.py)$'
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.15.0
hooks:
- id: pretty-format-java
args: [--autofix, --google-java-formatter-version=1.28.0]
files: '^java/.*\.java$'
- repo: https://github.com/commitizen-tools/commitizen
rev: v3.10.0
hooks:
- id: commitizen
stages: [commit-msg]
- repo: https://github.com/psf/black
rev: 23.9.1
hooks:
- id: black
language_version: python3
files: '^py.*\.py$'
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
args: ['--profile', 'black']
files: '^py.*\.py$'
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,13 @@ This repository includes several tools to help maintain code quality:
- [ESLint](https://eslint.org/docs/latest/use/core-concepts/): Checks your front-end code for quality and common errors.
- [pre-commit](https://pre-commit.com/): Ensures code formatting and quality checks are run before committing (primarily for back-end code).
- [lint-staged](https://github.com/okonet/lint-staged): Runs Prettier and ESLint on staged files before each commit to prevent bad code from being pushed.
- Note: if you are a Mac user, and your commits are erroring out with the message `" not foundECURSIVE_EXEC_FIRST_FAIL  Command "lint-staged`, then you likely need to change your line-endings in `./husky/pre-commit` and `./husky/commit-msg` from CRLF to LF.
- [commitizen](https://www.conventionalcommits.org/en/v1.0.0/): This pre-commit hook uses conventional commit syntax. Check this link out to understand how to format your commit messages. Here are some common examples:
- `feat: Major feature added`
- `docs: Documentation changed/updated`
- `fix: Bug fixed and code restored to working state`
- `refactor(style): Changed some code around to adhere to better style`
- `chore: Some update/chore that you've been needing to do`

---

Expand Down
30 changes: 29 additions & 1 deletion client/src/pages/HomePage.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,36 @@
import { useLoadingPixel } from '@/hooks';
import { Stack, Typography } from '@mui/material';

/**
* Renders the home page.
*
* @component
*/
export const HomePage = () => {
return <div>Home page</div>;
const [data, isLoading] = useLoadingPixel<string>('HelloUser()');

return (
<Stack spacing={2}>
<Typography variant="h4">Home page</Typography>
<Typography>
Welcome to the SEMOSS Template application! This repository is
meant to be a starting point for your own SEMOSS application.
</Typography>
<Typography variant="h6">Example pixel call:</Typography>
<ul>
<li>
<Typography variant="body1" fontWeight="bold">
HelloUser()
</Typography>
<ul>
<li>
<Typography fontStyle="italic">
{isLoading ? 'Loading...' : data}
</Typography>
</li>
</ul>
</li>
</ul>
</Stack>
);
};
19 changes: 0 additions & 19 deletions java/src/reactors/HelloWorldReactor.java

This file was deleted.

35 changes: 35 additions & 0 deletions java/src/reactors/example/HelloUserReactor.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package reactors.example;

import prerna.sablecc2.om.PixelDataType;
import prerna.sablecc2.om.ReactorKeysEnum;
import prerna.sablecc2.om.nounmeta.NounMetadata;
import reactors.AbstractProjectReactor;

public class HelloUserReactor extends AbstractProjectReactor {

// Note: Has access to protected variables defined in AbstractProjectReactor

public HelloUserReactor() {

// list of keys the reactor is expecting
this.keysToGet = new String[] {ReactorKeysEnum.NAME.getKey()};

// 1 for required keys, 0 for optional
this.keyRequired = new int[] {0};
}

@Override
protected NounMetadata doExecute() {

// returns null if the argument is not found
String name = this.keyValue.get(ReactorKeysEnum.NAME.getKey());

// if name is not provided, use the user's name
name = (name == null) ? user.getPrimaryLoginToken().getName() : name;

// grabbing user from AbstractProjectReactor
String response = "Hello, " + name + "! Welcome to SEMOSS.";

return new NounMetadata(response, PixelDataType.CONST_STRING);
}
}
1 change: 0 additions & 1 deletion java/src/util/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ public class Constants {

// TODO add any constants to be referenced in the project

public static final String HELLO_WORLD = "Hello World!";
}
9 changes: 1 addition & 8 deletions java/src/util/HelperMethods.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
package util;

import prerna.auth.User;

public class HelperMethods {

public static String getUserId(User user) {
return user.getPrimaryLoginToken().getId();
}
}
public class HelperMethods {}