Skip to content

Commit

Permalink
LUAFDN-1195: Expliticly license each file (#318)
Browse files Browse the repository at this point in the history
* Expliticly license each file, except upstream-derived files that do not have a license in upstream. Per meeting with Thomas Hwang, Heather Meeker, et al to eliminate unlicensed files that get source distribution through Studio plugins bundle.

* Pull in the Code Of Conduct we have in multiple other repos.
  • Loading branch information
RoFlection Bot committed Aug 29, 2022
1 parent 605a8f3 commit e0caaa2
Show file tree
Hide file tree
Showing 82 changed files with 970 additions and 10,467 deletions.
132 changes: 132 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
# Contributor Covenant Code of Conduct

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, caste, color, religion, or sexual identity
and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment for our
community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
overall community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.

Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.

## Scope

This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
[email protected].
All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
reporter of any incident.

## Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction

**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.

**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community Impact**: A violation through a single incident or series
of actions.

**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.

### 3. Temporary Ban

**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.

**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.

### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within
the community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
[https://www.contributor-covenant.org/version/2/0/code_of_conduct.html][v2.0].

Community Impact Guidelines were inspired by
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].

For answers to common questions about this code of conduct, see the FAQ at
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available
at [https://www.contributor-covenant.org/translations][translations].

[homepage]: https://www.contributor-covenant.org
[v2.0]: https://www.contributor-covenant.org/version/2/0/code_of_conduct.html
[Mozilla CoC]: https://github.com/mozilla/diversity
[FAQ]: https://www.contributor-covenant.org/faq
[translations]: https://www.contributor-covenant.org/translations
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) Roblox

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
14 changes: 14 additions & 0 deletions bin/spec.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
--[[
* Copyright (c) Roblox Corporation. All rights reserved.
* Licensed under the MIT License (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://opensource.org/licenses/MIT
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
]]
local processServiceExists, ProcessService = pcall(function()
return game:GetService("ProcessService")
end)
Expand Down
3 changes: 1 addition & 2 deletions foreman.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[tools]
rotrieve = { source = "roblox/rotriever", version = "=0.5.4" }
rojo = { source = "rojo-rbx/rojo", version = "7.2.1" }
selene = { source = "Kampfkarren/selene", version = "0.16.0" }
selene = { source = "Kampfkarren/selene", version = "0.20.0" }
stylua = { source = "JohnnyMorganz/StyLua", version = "=0.12.5" }
testez = { source = "roblox/testez", version = "0.3.2" }
run-in-roblox = { source = "rojo-rbx/run-in-roblox", version = "0.3.0" }
11 changes: 8 additions & 3 deletions modules/jest-react/src/JestReact.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
--[[
Roblox upstream: https://github.com/facebook/react/blob/e0f89aa056de95afc4c23909fce3d91fefb7dec7/packages/jest-react/src/JestReact.js
]]
-- ROBLOX upstream: https://github.com/facebook/react/blob/e0f89aa056de95afc4c23909fce3d91fefb7dec7/packages/jest-react/src/JestReact.js
--[[*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*]]

local Packages = script.Parent.Parent
local ReactSymbols = require(Packages.Shared).ReactSymbols
local REACT_ELEMENT_TYPE = ReactSymbols.REACT_ELEMENT_TYPE
Expand Down
15 changes: 13 additions & 2 deletions modules/jest-react/src/getJestMatchers.roblox.lua
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
--!strict
--[[
Roblox upstream: https://github.com/facebook/react/blob/69060e1da6061af845162dcf6854a5d9af28350a/scripts/jest/matchers/reactTestMatchers.js
ROBLOX upstream: https://github.com/facebook/react/blob/69060e1da6061af845162dcf6854a5d9af28350a/scripts/jest/matchers/reactTestMatchers.js
Note: this file is partially redundant with modules/scheduler/src/getJestMatchers.roblox.lua
That is also happening upstream: https://github.com/facebook/react/blob/47ff31a77add22bef54aaed9d4fb62d5aa693afd/scripts/jest/matchers/schedulerTestMatchers.js
]]

--[[**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*]]

local JestReact = require(script.Parent.JestReact)

local function captureAssertion(fn)
local function captureAssertion(
fn
): { pass: false, message: () -> string } | { pass: true }
-- Trick to use a TestEZ expectation matcher inside another Jest
-- matcher. `fn` contains an assertion; if it throws, we capture the
-- error and return it, so the stack trace presented to the user points
Expand Down
9 changes: 9 additions & 0 deletions modules/react-devtools-shared/src/__tests__/init.spec.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
-- ROBLOX upstream: https://github.com/facebook/react/blob/v17.0.1/packages/react-devtools-shared/src/__tests__/setupTests.js
--[[**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
*
* LICENSE file in the root directory of this source tree.
* @flow
*]]
return function()
local Packages = script.Parent.Parent.Parent
local jestExpect = require(Packages.Dev.JestGlobals).expect
Expand Down
2 changes: 1 addition & 1 deletion modules/react-devtools-shared/src/__tests__/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ exports.getRendererID = function(): number
end

-- ROBLOX FIXME: create Number.parseInt() in luau-polyfill
return id and tonumber(id) or Number.NaN
return if id then tonumber(id) else Number.NaN
end
exports.requireTestRenderer = function()
local hook
Expand Down
34 changes: 16 additions & 18 deletions modules/react-devtools-shared/src/backend/renderer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -589,12 +589,10 @@ exports.attach = function(
-- ROBLOX deviation: Use string nil rather than null as it is Roblox convenion
local displayName = getDisplayNameForFiber(fiber) or "nil"
local id = getFiberID(fiber)
local parentDisplayName = parentFiber ~= nil
and getDisplayNameForFiber(
parentFiber :: Fiber
)
or "nil"
local parentID = parentFiber and getFiberID(parentFiber :: Fiber) or ""
local parentDisplayName = if parentFiber ~= nil
then getDisplayNameForFiber(parentFiber :: Fiber)
else "nil"
local parentID = if parentFiber then getFiberID(parentFiber :: Fiber) else ""
-- NOTE: calling getFiberID or getPrimaryFiber is unsafe here
-- because it will put them in the map. For now, we'll omit them.
-- TODO: better debugging story for this.
Expand All @@ -605,13 +603,13 @@ exports.attach = function(
name,
displayName,
id,
parentFiber
and string.format(
"%s (%s)",
tostring(parentDisplayName),
tostring(parentID)
)
or ""
if parentFiber
then string.format(
"%s (%s)",
tostring(parentDisplayName),
tostring(parentID)
)
else ""
)
)
end
Expand Down Expand Up @@ -1183,7 +1181,7 @@ exports.attach = function(

local numUnmountIDs = #pendingRealUnmountedIDs
+ #pendingSimulatedUnmountedIDs
+ (pendingUnmountedRootID == nil and 0 or 1)
+ (if pendingUnmountedRootID == nil then 0 else 1)
local operations: Array<string | number> = Array.new(
-- ROBLOX deviation: don't create an array of specified length
-- Identify which renderer this update is coming from.
Expand Down Expand Up @@ -1338,8 +1336,8 @@ exports.attach = function(
pushOperation(TREE_OPERATION_ADD)
pushOperation(id)
pushOperation(ElementTypeRoot)
pushOperation(isProfilingSupported and 1 or 0)
pushOperation(hasOwnerMetadata and 1 or 0)
pushOperation(if isProfilingSupported then 1 else 0)
pushOperation(if hasOwnerMetadata then 1 else 0)

if isProfiling then
if displayNamesByRootID ~= nil then
Expand Down Expand Up @@ -2034,7 +2032,7 @@ exports.attach = function(
-- The frontend may request this information after profiling has stopped.
currentCommitProfilingMetadata = {
-- ROBLOX deviation: use bare table instead of Map type
changeDescriptions = recordChangeDescriptions and {} or nil,
changeDescriptions = if recordChangeDescriptions then {} else nil,
durations = {},
commitTime = getCurrentTime() - profilingStartTime,
-- ROBLOX TODO: Work out how to deviate this assignment, it's messy
Expand Down Expand Up @@ -2110,7 +2108,7 @@ exports.attach = function(
-- The frontend may request this information after profiling has stopped.
currentCommitProfilingMetadata = {
-- ROBLOX deviation: use bare table instead of Map type
changeDescriptions = recordChangeDescriptions and {} or nil,
changeDescriptions = if recordChangeDescriptions then {} else nil,
durations = {},
commitTime = getCurrentTime() - profilingStartTime,
interactions = Array.map(
Expand Down
8 changes: 4 additions & 4 deletions modules/react-devtools-shared/src/devtools/store.lua
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ function Store:setCollapseNodesByDefault(value: boolean)

localStorageSetItem(
LOCAL_STORAGE_COLLAPSE_ROOTS_BY_DEFAULT_KEY,
value and "true" or "false"
if value then "true" else "false"
)
self:emit("collapseNodesByDefault")
end
Expand Down Expand Up @@ -479,7 +479,7 @@ function Store:setRecordChangeDescriptions(value: boolean): ()

localStorageSetItem(
LOCAL_STORAGE_RECORD_CHANGE_DESCRIPTIONS_KEY,
value and "true" or "false"
if value then "true" else "false"
)
self:emit("recordChangeDescriptions")
end
Expand Down Expand Up @@ -555,7 +555,7 @@ function Store:getElementAtIndex(index: number): Element?
for i = 1, numChildren do
local childID = currentElement.children[i]
local child = self._idToElement[childID]
local childWeight = child.isCollapsed and 1 or child.weight
local childWeight = if child.isCollapsed then 1 else child.weight
if index <= currentWeight + childWeight then
currentWeight += 1
currentElement = child
Expand Down Expand Up @@ -616,7 +616,7 @@ function Store:getIndexOfElementID(id: number): number | nil
end

local child = self._idToElement[childID]
index += child.isCollapsed and 1 or child.weight
index += if child.isCollapsed then 1 else child.weight
end

-- We found the root; stop crawling.
Expand Down
Loading

0 comments on commit e0caaa2

Please sign in to comment.